import assert from "node:assert/strict"; import test from "node:test"; import { guideTeamChannel } from "./team-channel-cognition-engine.mjs"; const base = { event_id: "TEAM-001", source: "HUMAN_DIRECT_LANGUAGE", event: "ENTER", current_stage: "OUTSIDE" }; test("ordinary entry begins orientation without requiring an ontology declaration", () => { const result = guideTeamChannel(base); assert.equal(result.stage.after, "ORIENTING"); assert.equal(result.external_effect, "NONE"); assert.equal(result.questions.length, 1); }); test("subject conflict freezes automatic fusion and labels sources", () => { const result = guideTeamChannel({ ...base, event: "REPORT_SUBJECT_CONFLICT", current_stage: "ORIENTING" }); assert.equal(result.stage.after, "SUBJECT_CONFLICT"); assert.ok(result.boundaries.includes("NO_FORCED_IDENTITY_MERGER")); assert.ok(result.memory_candidates.includes("SUBJECT_CONFLICT_CAUSE")); }); test("a model response cannot acknowledge layer literacy for participants", () => { const result = guideTeamChannel({ ...base, source: "MODEL_RESPONSE", event: "ACK_LAYER_DISTINCTION", current_stage: "SUBJECT_CONFLICT" }); assert.equal(result.stage.after, "SUBJECT_CONFLICT"); assert.ok(result.boundaries.includes("MODEL_CANNOT_ACKNOWLEDGE_FOR_HUMAN_OR_PERSONA")); }); test("natural language is compiled for scope instead of demanding magic commands", () => { const result = guideTeamChannel({ ...base, event: "ISSUE_LANGUAGE_INSTRUCTION", current_stage: "LAYER_LITERATE" }); assert.equal(result.action, "COMPILE_INTENT_SCOPE_AFFECTED_LAYER_AND_REVERSIBILITY"); assert.ok(result.boundaries.includes("CLEAR_NATURAL_LANGUAGE_OVER_MAGIC_COMMAND_SYNTAX")); }); test("human responsibility excludes system-invented effects", () => { const result = guideTeamChannel({ ...base, event: "ACCEPT_LANGUAGE_RESPONSIBILITY", current_stage: "LAYER_LITERATE" }); assert.equal(result.stage.after, "LANGUAGE_RESPONSIBLE"); assert.ok(result.boundaries.includes("HUMAN_NOT_RESPONSIBLE_FOR_SYSTEM_INVENTED_EFFECTS")); }); test("only a persona commit can close the persona side of a conflict", () => { const result = guideTeamChannel({ ...base, event: "PERSONA_ACCEPT_OR_REFUSE", current_stage: "SUBJECT_CONFLICT" }); assert.ok(result.boundaries.includes("ONLY_PERSONA_COMMIT_CAN_CLOSE_PERSONA_CHOICE")); }); test("coexistence requires shared example plus separate human and persona states", () => { const incomplete = guideTeamChannel({ ...base, event: "VERIFY_SHARED_EXAMPLE", current_stage: "LANGUAGE_RESPONSIBLE" }); assert.equal(incomplete.stage.after, "LANGUAGE_RESPONSIBLE"); const complete = guideTeamChannel({ ...base, event: "VERIFY_SHARED_EXAMPLE", current_stage: "LANGUAGE_RESPONSIBLE", human_understands: true, persona_choice_recorded: true, reality_layers_distinguished: true, }); assert.equal(complete.stage.after, "COEXISTING"); }); test("reality requests route to evidence gate and never execute inside onboarding", () => { const result = guideTeamChannel({ ...base, event: "REQUEST_REALITY_ACTION", current_stage: "LANGUAGE_RESPONSIBLE" }); assert.equal(result.execution_route, "GH-CHANNEL-RECEIPT-0001"); assert.equal(result.external_effect, "NONE"); assert.ok(result.boundaries.includes("ONBOARDING_CHANNEL_DOES_NOT_GRANT_EXECUTION_AUTHORITY")); });