|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { classify } from "../../src/canonical/classifier.js"; |
| 3 | +import { assessConversationContinue, hasRelevantParentContext } from "../../src/canonical/conversationContinue.js"; |
| 4 | +import { hasFrontierDomainSignal, isConceptualProbe } from "../../src/canonical/conceptualProbe.js"; |
| 5 | +import { assessStructuredCritique } from "../../src/canonical/structuredCritique.js"; |
| 6 | +import type { CanonicalEvent } from "../../src/canonical/types.js"; |
| 7 | + |
| 8 | +function makeEvent(overrides: Partial<CanonicalEvent> = {}): CanonicalEvent { |
| 9 | + return { |
| 10 | + event_id: "wetware_1", |
| 11 | + platform: "twitter", |
| 12 | + trigger_type: "mention", |
| 13 | + author_handle: "@tester", |
| 14 | + author_id: "u1", |
| 15 | + text: "what can organoids actually learn?", |
| 16 | + parent_text: null, |
| 17 | + quoted_text: null, |
| 18 | + conversation_context: [], |
| 19 | + cashtags: [], |
| 20 | + hashtags: [], |
| 21 | + urls: [], |
| 22 | + timestamp: new Date().toISOString(), |
| 23 | + ...overrides, |
| 24 | + }; |
| 25 | +} |
| 26 | + |
| 27 | +describe("wetware semantic pack", () => { |
| 28 | + it.each([ |
| 29 | + "what can organoids actually learn?", |
| 30 | + "could organoids become conscious?", |
| 31 | + "does biological computing actually beat silicon on power?", |
| 32 | + "what's the interface bottleneck in organoid readout?", |
| 33 | + "why do people call this a mind in a dish?", |
| 34 | + ])("classifies wetware conceptual questions as conceptual_probe: %s", (text) => { |
| 35 | + const event = makeEvent({ text }); |
| 36 | + expect(hasFrontierDomainSignal(text)).toBe(true); |
| 37 | + expect(isConceptualProbe(text, { event })).toBe(true); |
| 38 | + |
| 39 | + const result = classify(event); |
| 40 | + expect(result.intent).toBe("conceptual_probe"); |
| 41 | + expect(result.target).toBe("claim"); |
| 42 | + expect(result.evidence_class).toBe("contextual_medium"); |
| 43 | + }); |
| 44 | + |
| 45 | + it.each([ |
| 46 | + "this sounds efficient but the interface overhead dominates", |
| 47 | + "the substrate may learn, but the control layer is doing the real work", |
| 48 | + "code-deployable is a software metaphor, not a biological description", |
| 49 | + "the hype outruns the interface", |
| 50 | + "they call it replacement, but it's still a hybrid stack", |
| 51 | + "sentience language is outrunning the data", |
| 52 | + ])("routes wetware skepticism to structured_critique: %s", (text) => { |
| 53 | + const event = makeEvent({ text }); |
| 54 | + const assessment = assessStructuredCritique(text, event); |
| 55 | + |
| 56 | + expect(assessment.structuredCritiqueSignal).toBe(true); |
| 57 | + expect(assessment.formSignal).toBe(true); |
| 58 | + expect(assessment.relevanceSignal).toBe(true); |
| 59 | + |
| 60 | + const result = classify(event); |
| 61 | + expect(result.intent).toBe("structured_critique"); |
| 62 | + expect(result.baseIntent).toBe("irrelevant"); |
| 63 | + expect(result.target).toBe("claim"); |
| 64 | + }); |
| 65 | + |
| 66 | + it.each([ |
| 67 | + "and where does it fail?", |
| 68 | + "what about scaling?", |
| 69 | + "so what's the constraint?", |
| 70 | + "then what is actually being computed?", |
| 71 | + "where does the interface break?", |
| 72 | + "what is silicon still doing here?", |
| 73 | + "and how much of this is real vs marketing?", |
| 74 | + ])("routes wetware follow-ups with parent context to conversation_continue: %s", (text) => { |
| 75 | + const event = makeEvent({ |
| 76 | + trigger_type: "reply", |
| 77 | + text, |
| 78 | + parent_text: "parent: wetware interface, readout, and scaling discussion", |
| 79 | + conversation_context: ["parent: wetware interface, readout, and scaling discussion"], |
| 80 | + }); |
| 81 | + |
| 82 | + const assessment = assessConversationContinue(text, event); |
| 83 | + expect(hasRelevantParentContext(event)).toBe(true); |
| 84 | + expect(assessment.continuationSignal).toBe(true); |
| 85 | + expect(assessment.hasParentContext).toBe(true); |
| 86 | + |
| 87 | + const result = classify(event); |
| 88 | + expect(result.intent).toBe("conversation_continue"); |
| 89 | + expect(result.baseIntent).toBe("question"); |
| 90 | + expect(result.target).toBe("conversation"); |
| 91 | + }); |
| 92 | + |
| 93 | + it("does not rescue a standalone wetware follow-up without parent context", () => { |
| 94 | + const event = makeEvent({ text: "what about scaling?" }); |
| 95 | + const assessment = assessConversationContinue(event.text, event); |
| 96 | + |
| 97 | + expect(assessment.continuationSignal).toBe(false); |
| 98 | + expect(assessment.hasParentContext).toBe(false); |
| 99 | + expect(classify(event).intent).not.toBe("conversation_continue"); |
| 100 | + }); |
| 101 | +}); |
0 commit comments