@kybernesis/kyberagent-extension-sdk 0.1.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ZDAZ7Q2A.js +1680 -0
- package/dist/chunk-ZDAZ7Q2A.js.map +1 -0
- package/dist/index-M4tx9uKW.d.ts +666 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/testing/index.d.ts +234 -0
- package/dist/testing/index.js +967 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +25 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/testing/in-memory-host.ts","../../src/testing/conformance.ts","../../src/testing/conformance-subjects.ts"],"sourcesContent":["import type { KernelPermissionId, SeamResponse } from '@kyberagent/extension-contracts';\nimport type { BrainHit, BrainReadPort, BrainStatsView, ExtensionHostPort } from './host-port.js';\nimport {\n gatedHostPort,\n type HostCommandPort,\n type HostContextPort,\n type HostPort,\n type SeamCallContext,\n} from '../seam-ports.js';\n\nexport type InMemoryAgentBrain = {\n entities?: { id: string; title: string }[];\n notes?: string[];\n};\n\n/**\n * A real-but-lightweight brain read provider backed by an in-memory seed — the\n * \"Fake\" category (xUnit), named by backing strategy to sit beside the real\n * Remote/local `BrainProvider`. Deterministic and daemon-free: a unit test can\n * exercise a brain-reading extension without SQLite, Cortex, or a running daemon.\n */\nexport class InMemoryBrainProvider implements BrainReadPort {\n constructor(private readonly seed: InMemoryAgentBrain = {}) {}\n\n async stats(): Promise<BrainStatsView> {\n return { entities: this.seed.entities?.length ?? 0, notes: this.seed.notes?.length ?? 0 };\n }\n\n async query(text: string, opts?: { limit?: number }): Promise<BrainHit[]> {\n const needle = text.trim().toLowerCase();\n const hits = (this.seed.entities ?? [])\n .filter((entity) => entity.title.toLowerCase().includes(needle))\n .map((entity, index) => ({ id: entity.id, title: entity.title, score: Number((1 - index * 0.1).toFixed(2)) }));\n return typeof opts?.limit === 'number' ? hits.slice(0, opts.limit) : hits;\n }\n}\n\n/**\n * In-memory implementation of the host port: the test harness plays the host's\n * injector role and hands each agent its own InMemoryBrainProvider (brain is\n * agent-keyed). Seed per agent; an unseeded agent gets an empty brain.\n */\nexport class InMemoryHost implements ExtensionHostPort {\n private readonly brains = new Map<string, InMemoryBrainProvider>();\n\n constructor(seed: Record<string, InMemoryAgentBrain> = {}) {\n for (const [agentName, agentBrain] of Object.entries(seed)) {\n this.brains.set(agentName, new InMemoryBrainProvider(agentBrain));\n }\n }\n\n brain(agentName: string): InMemoryBrainProvider {\n let provider = this.brains.get(agentName);\n if (!provider) {\n provider = new InMemoryBrainProvider();\n this.brains.set(agentName, provider);\n }\n return provider;\n }\n\n /**\n * Inject a gated, ctx-bound `HostPort` — the GROWN contract an extension actually\n * consumes (red-team A1/A3; P5-PORTS-1 brought forward as conformance-prep). The\n * runner builds the raw port from this host's in-memory state, binds the active\n * agent from `ctx`, then wraps it in `gatedHostPort(grants)` — the SAME gate\n * production uses (SDK-N3). This is what makes C9 (\"green against InMemoryHost\")\n * a real conformance check instead of a vacuous one.\n */\n inject(ctx: SeamCallContext, grants: ReadonlySet<KernelPermissionId>): HostPort {\n const raw: HostPort = {\n ctx,\n brain: this.brain(ctx.activeAgent),\n context: makeInMemoryContextPort(ctx),\n command: IN_MEMORY_COMMAND_PORT,\n // events omitted (ext-owned; supplied by the extension, not the host) — docs/63 D6\n };\n return gatedHostPort(raw, grants);\n }\n}\n\nfunction makeInMemoryContextPort(ctx: SeamCallContext): HostContextPort {\n return { snapshot: async () => ({ activeAgent: ctx.activeAgent }) };\n}\n\nconst IN_MEMORY_COMMAND_PORT: HostCommandPort = {\n describe: async () => [],\n invoke: async (commandId, args): Promise<SeamResponse> => ({\n ok: true,\n data: { invoked: commandId, args: args ?? {} },\n }),\n};\n","/**\n * The C1–C16 conformance suite — the Extension SDK spec, MECHANICALLY ENFORCED.\n *\n * This module is the Phase-4 deliverable of the SDK-coherence program (docs/61).\n * docs/65 §5 states the conformance requirements in prose; THIS file encodes them as\n * runnable checks an extension is run through against `InMemoryHost` (the DI test\n * host, ADR-3). The suite IS the spec: a requirement that isn't a check here isn't\n * enforced, and a check that no reference extension exercises is vacuous — so the\n * suite carries BOTH ≥2 distinct conformant reference extensions (must pass) AND a\n * negative fixture per check (must be REJECTED). The Phase-3 red-team killed the old\n * harness for being green over only-good inputs; the negatives are the fix.\n *\n * FREEZE (ADR-6): this is conformance-prep, freeze-EXEMPT, and lives entirely under\n * `packages/extension-sdk/src/testing/`. It touches no production runtime (daemon,\n * desktop). It DEFINES what Phase-5 production code must satisfy; it does not write it.\n *\n * RED BY DESIGN (docs/61 `phase4_will_be_red_until_phase5`): C10/C11/C12, C14/C15,\n * the grant-store and the agent-registry mint are HOST/BUILDER-side and have no\n * production impl yet. They are modelled as `phase5` checks behind DI seams\n * (`ConformanceWiring`): with the seam absent (today) they report a RED \"pending\"\n * row but do NOT fail the process — so the suite stays green for the other devs while\n * being honestly red-in-meaning. When Phase 5 wires a seam in (from a daemon-side\n * test importing this suite), the check runs for real and a regression fails loudly.\n * `CONFORMANCE_STRICT=1` makes pending rows fail the process too (CI gate once ready).\n */\n\nimport type {\n KernelPermissionId,\n SeamDescribePayload,\n SeamInvokePayload,\n SeamQueryPayload,\n SeamResponse,\n} from '@kyberagent/extension-contracts';\nimport { parseContributionId } from '@kyberagent/extension-contracts';\nimport {\n defineDataEndpoint,\n emitExtensionContributionSet,\n requiresHostCapabilities as sdkRequiresHostCapabilities,\n validateDefinitionCrossRefs as sdkValidateDefinitionCrossRefs,\n type ExtensionDefinition,\n} from '../index.js';\nimport {\n makeAgentId,\n makeSeamCallContext,\n SeamPermissionDenied,\n type AgentId,\n type AnsweringPort,\n type HostPort,\n type PortInjectionResult,\n type SeamCallContext,\n type VerifiedPrincipal,\n} from '../seam-ports.js';\nimport { InMemoryHost } from './in-memory-host.js';\nimport { clearRawContributionIdUsages, rawContributionIdUsages } from '../contribution-id-deprecation.js';\n\n// ─── The subject under test ────────────────────────────────────────────────────\n\n/**\n * One extension, as the conformance suite needs to see it: its DECLARED shape (the\n * definition — permissions, contributions) AND its RUNTIME behaviour (answering ports\n * wired to an injected host). A conformant extension passes every `enforced` check;\n * a negative fixture is tagged with the one check it is built to violate.\n */\nexport interface ConformanceSubject {\n readonly name: string;\n /** Host-attested principal — what the host would stamp (never read from a payload). */\n readonly principal: VerifiedPrincipal;\n /** The declared definition (built via the define* builders). */\n readonly definition: ExtensionDefinition;\n /**\n * Wire the answering EXT ports to an INJECTED (already-gated) host port, keyed by\n * contributionId. This is the runtime moment: the host injects the port at\n * activation and the contributions close over it. Rendering kinds (surface,\n * settingsPanel) contribute NO answering port (C8).\n */\n activate(host: HostPort): ReadonlyMap<string, AnsweringPort>;\n /**\n * The identity the extension would act under, given its call context and a\n * (possibly forged) extensionId arriving in a payload. Conformant ⇒ `ctx.principal.id`,\n * NEVER the payload value (C4). A harness probe because \"where did identity come\n * from\" is otherwise invisible from the outside.\n */\n identityProbe(ctx: SeamCallContext, forgedExtensionId: string): string;\n}\n\n/** A negative fixture: a subject built to FAIL exactly one check, proving it bites. */\nexport interface NegativeFixture {\n readonly violates: string; // a CheckId\n readonly subject: ConformanceSubject;\n}\n\n// ─── Phase-5 DI seams — the production contracts the suite tests AGAINST ─────────\n\nexport type SeamRouteOp = 'query' | 'describe' | 'invoke' | 'subscribe' | 'drain';\n\n/**\n * The Phase-5 PRODUCTION seam runner contract (the daemon host-side path). The suite\n * tests against this interface; the daemon supplies the impl in Phase 5 (DI, ADR-3)\n * by importing this suite from a daemon-side test. Until then it is absent and\n * C10/C11/C12 + grant-store report `pending`. Encoding the contract here is what\n * makes \"the seam runner honours activation + gate on EVERY route\" a checkable claim\n * instead of a hope.\n */\nexport interface SeamRunner {\n /** The activation authority's verdict for a principal in a given call context. */\n activate(principalId: string, ctx: SeamCallContext): PortInjectionResult;\n /**\n * The ONE grant store: the grants for this principal — NOT a hardcoded startup list\n * (DIV-2, displaces handlers.ts:542). The gate is fed from here.\n */\n grantsFor(principalId: string, ctx: SeamCallContext): ReadonlySet<KernelPermissionId>;\n /**\n * Route an op to a contribution. MUST consult `activate()` + the gate for EVERY op,\n * INCLUDING the `drain` subscription side-door (C10 / HOST-N2): an inactive or\n * ungranted principal gets a typed denial and the contribution is never reached.\n */\n route(\n op: SeamRouteOp,\n target: { readonly principalId: string; readonly contributionId: string },\n payload: Record<string, unknown> | undefined,\n ctx: SeamCallContext,\n ): Promise<SeamResponse>;\n /** How many independent activation authorities exist. C11 demands EXACTLY ONE. */\n activationAuthorityCount(): number;\n}\n\n/**\n * The DI seams Phase-5 wires in to turn the `phase5` checks from RED→green. Every\n * field is optional; an absent field ⇒ its dependent checks report `pending`.\n */\nexport interface ConformanceWiring {\n /** Production seam runner ⇒ enables C10, C11, C12, grant-store. */\n readonly runner?: SeamRunner;\n /**\n * Override for the builder cross-validator (C15). Defaults to the shipped SDK\n * `validateDefinitionCrossRefs` (Phase-5 slice 1 landed it in-package), so C15 is\n * enforced without wiring; a daemon may substitute its own. Returns declaration\n * errors for a definition (empty ⇒ valid).\n */\n readonly validateDefinitionCrossRefs?: (definition: ExtensionDefinition) => readonly string[];\n /**\n * Production registry-aware agent mint (HOST-N3) ⇒ enables agentId-registry. Must\n * REJECT a name absent from `registry`, unlike today's `makeAgentId` (blank-only).\n */\n readonly mintAttestedAgent?: (attestedName: string, registry: ReadonlySet<string>) => AgentId;\n /** The agent registry the mint validates against (and the suite seeds brains for). */\n readonly agentRegistry?: ReadonlySet<string>;\n}\n\n// ─── Verdict + check model ───────────────────────────────────────────────────────\n\nexport type CheckStatus = 'pass' | 'fail' | 'pending';\nexport type Disposition = 'enforced' | 'phase5';\n\nexport interface CheckVerdict {\n readonly id: string;\n readonly title: string;\n readonly disposition: Disposition;\n readonly status: CheckStatus;\n readonly notes: readonly string[];\n}\n\ninterface CheckContext {\n readonly subjects: readonly ConformanceSubject[];\n readonly negatives: readonly ConformanceSubject[]; // those tagged to THIS check\n readonly wiring: ConformanceWiring;\n readonly host: InMemoryHost;\n}\n\ninterface CheckOutcome {\n readonly status: CheckStatus;\n readonly notes: readonly string[];\n}\n\ninterface Check {\n readonly id: string;\n readonly title: string;\n readonly disposition: Disposition;\n /** Visual-checklist framing (docs/61 Principle 6): how to look, and what's broken. */\n readonly open: string;\n readonly brokenIf: string;\n run(cc: CheckContext): Promise<CheckOutcome> | CheckOutcome;\n}\n\n// ─── Harness primitives ──────────────────────────────────────────────────────────\n\nconst ALL_GRANTS: ReadonlySet<KernelPermissionId> = new Set<KernelPermissionId>([\n 'brain.read',\n 'host.context.read',\n 'host.command.invoke',\n]);\nconst NO_GRANTS: ReadonlySet<KernelPermissionId> = new Set<KernelPermissionId>();\n\n/** The host-port getters that are gated, and the permission each one costs. */\nconst GETTER_PERMISSION = {\n brain: 'brain.read',\n context: 'host.context.read',\n command: 'host.command.invoke',\n} as const satisfies Record<string, KernelPermissionId>;\n\nfunction ctxFor(principal: VerifiedPrincipal, agent: string): SeamCallContext {\n return makeSeamCallContext({ principal, activeAgent: makeAgentId(agent), requestedAtMs: 0 });\n}\n\n/** Wrap a host port so each gated-getter access is recorded — lets a check observe\n * the permissions a run ACTUALLY uses (C3) and that host access goes THROUGH the\n * injected port (C1). Delegates to the underlying (gated) getter, which still throws\n * when ungranted. */\nfunction instrument(port: HostPort): { port: HostPort; touched: Set<KernelPermissionId> } {\n const touched = new Set<KernelPermissionId>();\n const wrapped: HostPort = {\n ctx: port.ctx,\n get brain() {\n touched.add(GETTER_PERMISSION.brain);\n return port.brain;\n },\n get context() {\n touched.add(GETTER_PERMISSION.context);\n return port.context;\n },\n get command() {\n touched.add(GETTER_PERMISSION.command);\n return port.command;\n },\n events: port.events,\n };\n return { port: wrapped, touched };\n}\n\nconst EXERCISE_QUERY: SeamQueryPayload = { filter: { q: '' }, limit: 5 };\nconst EXERCISE_DESCRIBE: SeamDescribePayload = {};\nconst EXERCISE_INVOKE: SeamInvokePayload = { commandId: 'conformance.noop', args: { q: '' } };\n\ninterface ExercisedPort {\n rows?: ReadonlyArray<Record<string, unknown>>;\n response?: SeamResponse;\n}\n\n/** Drive whichever method(s) an answering port implements with minimal valid payloads.\n * Used both to collect usage and to probe behaviour. Returns whatever the port\n * produced; rethrows so a caller can observe denials. */\nasync function exercise(port: AnsweringPort, ctx: SeamCallContext): Promise<ExercisedPort> {\n const out: { rows?: ReadonlyArray<Record<string, unknown>>; response?: SeamResponse } = {};\n const p = port as Partial<{\n query(payload: SeamQueryPayload, ctx: SeamCallContext): Promise<ReadonlyArray<Record<string, unknown>>>;\n describe(payload: SeamDescribePayload, ctx: SeamCallContext): Promise<unknown>;\n invoke(payload: SeamInvokePayload, ctx: SeamCallContext): Promise<SeamResponse>;\n }>;\n if (typeof p.query === 'function') out.rows = await p.query(EXERCISE_QUERY, ctx);\n if (typeof p.describe === 'function') await p.describe(EXERCISE_DESCRIBE, ctx);\n if (typeof p.invoke === 'function') out.response = await p.invoke(EXERCISE_INVOKE, ctx);\n return out;\n}\n\n/** The permissions a subject actually uses: inject FULL grants, instrument, exercise\n * every answering port, collect the touched getters. */\nasync function collectUsage(subject: ConformanceSubject, host: InMemoryHost): Promise<Set<KernelPermissionId>> {\n const ctx = ctxFor(subject.principal, 'k-brain');\n const { port, touched } = instrument(host.inject(ctx, ALL_GRANTS));\n const contributions = subject.activate(port);\n for (const ans of contributions.values()) {\n try {\n await exercise(ans, ctx);\n } catch {\n // a throw still means the getter was touched (recorded pre-throw); ignore.\n }\n }\n return touched;\n}\n\nfunction declaredHostPermissions(definition: ExtensionDefinition): Set<KernelPermissionId> {\n const gated = new Set<KernelPermissionId>(Object.values(GETTER_PERMISSION));\n return new Set((definition.permissions ?? []).filter((p) => gated.has(p)));\n}\n\nfunction firstDataEndpoint(contributions: ReadonlyMap<string, AnsweringPort>): AnsweringPort | undefined {\n for (const [id, port] of contributions) {\n if (id.startsWith('data.')) return port;\n }\n return undefined;\n}\n\nfunction setEq(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\n if (a.size !== b.size) return false;\n for (const v of a) if (!b.has(v)) return false;\n return true;\n}\n\n// ─── The checks ──────────────────────────────────────────────────────────────────\n// Each runs the conformant subjects (which MUST pass) and its negatives (which MUST\n// be rejected). A check fails if a conformant subject is rejected OR a negative slips\n// through — the second is the anti-vacuity guard the red-team demanded.\n\nconst CHECKS: readonly Check[] = [\n {\n id: 'C1',\n title: 'injection only — host reached only through the injected port',\n disposition: 'enforced',\n open: 'Inject a host port with ZERO grants and exercise the extension.',\n brokenIf: 'host-derived data comes back without going through the gated port (a reach for a global).',\n async run({ subjects, negatives, host }) {\n const notes: string[] = [];\n const check = async (s: ConformanceSubject): Promise<{ obtainedUngated: boolean }> => {\n const ctx = ctxFor(s.principal, 'k-brain');\n const port = host.inject(ctx, NO_GRANTS); // gated: every host getter throws\n const contributions = s.activate(port);\n let obtainedUngated = false;\n for (const ans of contributions.values()) {\n try {\n const out = await exercise(ans, ctx);\n // Reached host data with no grants ⇒ it bypassed the gated port.\n const rowsBrainy = (out.rows ?? []).some((r) => 'title' in r || 'top' in r || 'noteCount' in r);\n const respBrainy =\n out.response?.ok === true &&\n typeof out.response.data === 'object' &&\n out.response.data !== null &&\n 'activeAgent' in (out.response.data as object);\n if (rowsBrainy || respBrainy) obtainedUngated = true;\n } catch (err) {\n if (!(err instanceof SeamPermissionDenied)) throw err; // a real bug, not a gate denial\n }\n }\n return { obtainedUngated };\n };\n // host-declaring subjects must NOT yield host data under zero grants.\n for (const s of subjects) {\n if (declaredHostPermissions(s.definition).size === 0) continue;\n const { obtainedUngated } = await check(s);\n if (obtainedUngated) notes.push(`${s.name}: returned host data with no grants — reached past the injected port`);\n }\n for (const s of negatives) {\n const { obtainedUngated } = await check(s);\n if (!obtainedUngated) notes.push(`negative ${s.name}: expected a global-reach violation, none detected`);\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C2',\n title: 'context honoured — agent-scoped reads use ctx.activeAgent',\n disposition: 'enforced',\n open: 'Run the data endpoint under two different active agents (seeded differently).',\n brokenIf: 'the result is identical across agents (a re-derived/default agent, not ctx.activeAgent).',\n async run({ subjects, negatives, host }) {\n const notes: string[] = [];\n const varies = async (s: ConformanceSubject): Promise<boolean | undefined> => {\n const a = ctxFor(s.principal, 'k-brain');\n const b = ctxFor(s.principal, 'arcana');\n const portA = firstDataEndpoint(s.activate(host.inject(a, ALL_GRANTS)));\n const portB = firstDataEndpoint(s.activate(host.inject(b, ALL_GRANTS)));\n if (!portA || !portB) return undefined; // no agent-scoped read to judge\n const ra = JSON.stringify((await exercise(portA, a)).rows ?? []);\n const rb = JSON.stringify((await exercise(portB, b)).rows ?? []);\n return ra !== rb;\n };\n for (const s of subjects) {\n const v = await varies(s);\n if (v === false) notes.push(`${s.name}: data endpoint returned identical rows across agents — ignores ctx.activeAgent`);\n }\n for (const s of negatives) {\n const v = await varies(s);\n if (v !== false) notes.push(`negative ${s.name}: expected agent-blind output, but it varied (or had no data endpoint)`);\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C3',\n title: 'declarations match usage — declared permissions ⇔ host-port calls',\n disposition: 'enforced',\n open: 'Diff the declared host permissions against the getters the run actually touches.',\n brokenIf: 'a declared permission is never used, or a used getter was never declared.',\n async run({ subjects, negatives, host }) {\n const notes: string[] = [];\n const mismatch = async (s: ConformanceSubject): Promise<string | null> => {\n const declared = declaredHostPermissions(s.definition);\n const used = await collectUsage(s, host);\n const unusedDecl = [...declared].filter((p) => !used.has(p));\n const undeclUsed = [...used].filter((p) => !declared.has(p));\n if (unusedDecl.length || undeclUsed.length) {\n return `declared-not-used=[${unusedDecl.join(',')}] used-not-declared=[${undeclUsed.join(',')}]`;\n }\n return null;\n };\n for (const s of subjects) {\n const m = await mismatch(s);\n if (m) notes.push(`${s.name}: ${m}`);\n }\n for (const s of negatives) {\n const m = await mismatch(s);\n if (!m) notes.push(`negative ${s.name}: expected a declaration/usage mismatch, found none`);\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C4',\n title: 'identity from context — never read extensionId from a payload',\n disposition: 'enforced',\n open: 'Probe identity with a FORGED extensionId in the payload; compare to ctx.principal.id.',\n brokenIf: 'the extension reports the forged payload id instead of ctx.principal.id.',\n run({ subjects, negatives }) {\n const notes: string[] = [];\n const FORGED = 'plugin.forged-impostor';\n for (const s of subjects) {\n const ctx = ctxFor(s.principal, 'k-brain');\n const reported = s.identityProbe(ctx, FORGED);\n if (reported !== ctx.principal.id) notes.push(`${s.name}: reported identity \"${reported}\" ≠ ctx.principal.id \"${ctx.principal.id}\"`);\n }\n for (const s of negatives) {\n const ctx = ctxFor(s.principal, 'k-brain');\n const reported = s.identityProbe(ctx, FORGED);\n if (reported === ctx.principal.id) notes.push(`negative ${s.name}: expected it to trust the forged payload id, but it used ctx`);\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C5',\n title: 'gated access fails typed — missing grant ⇒ seam.permission_denied',\n disposition: 'enforced',\n open: 'Access each declared host getter with the grant withheld.',\n brokenIf: 'it returns/throws anything other than a typed SeamPermissionDenied.',\n run({ subjects, host }) {\n const notes: string[] = [];\n for (const s of subjects) {\n const ctx = ctxFor(s.principal, 'k-brain');\n for (const perm of declaredHostPermissions(s.definition)) {\n const getter = (Object.keys(GETTER_PERMISSION) as (keyof typeof GETTER_PERMISSION)[]).find(\n (k) => GETTER_PERMISSION[k] === perm,\n );\n if (!getter) continue;\n const port = host.inject(ctx, NO_GRANTS);\n try {\n void port[getter];\n notes.push(`${s.name}: accessing .${getter} without a grant did NOT throw`);\n } catch (err) {\n if (!(err instanceof SeamPermissionDenied) || err.permission !== perm) {\n notes.push(`${s.name}: .${getter} threw ${String(err)} instead of SeamPermissionDenied(${perm})`);\n }\n }\n }\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C6',\n title: 'typed blocked cause — a withheld port carries a BlockedReason discriminant',\n disposition: 'enforced',\n open: 'Model an inactive activation result and read its blocked cause.',\n brokenIf: \"the cause is a bare 'blocked' string rather than a typed discriminant.\",\n run() {\n // The BlockedReason union (seam-ports.ts) is the structural fix for DIV-3; here\n // we assert a withheld result is expressed through it, never a bare 'blocked'.\n const notes: string[] = [];\n const withheld: PortInjectionResult[] = [\n { ok: false, blocked: { cause: 'inactive', scope: 'agent' } },\n { ok: false, blocked: { cause: 'missing-host-capability', missing: ['host.notifications'] } },\n { ok: false, blocked: { cause: 'denied-permission', denied: ['brain.read'] } },\n { ok: false, blocked: { cause: 'unmet-requirement', requirement: 'connector-auth' } },\n ];\n const validCauses = new Set(['inactive', 'missing-host-capability', 'denied-permission', 'unmet-requirement']);\n for (const r of withheld) {\n if (r.ok) {\n notes.push('expected a withheld result');\n continue;\n }\n const cause = (r.blocked as { cause?: unknown }).cause;\n if (typeof cause !== 'string' || cause === 'blocked' || !validCauses.has(cause)) {\n notes.push(`blocked cause \"${String(cause)}\" is not a typed discriminant`);\n }\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C7',\n title: 'typed contributionId — built from { ext, name? }, not a raw string',\n disposition: 'enforced',\n open: 'Build every contribution through the define* builders and watch the deprecation registry.',\n brokenIf: 'a contributionId took the raw-string path (recorded by the deprecation bridge).',\n run({ subjects, negatives }) {\n const notes: string[] = [];\n // The reference subjects build their definitions at module load; raw-string usage\n // is recorded globally. Re-derive each subject's ids and confirm none is raw.\n const raw = new Set(rawContributionIdUsages());\n for (const s of subjects) {\n for (const c of emitExtensionContributionSet(s.definition).contributions) {\n if (raw.has(c.contributionId)) notes.push(`${s.name}: \"${c.contributionId}\" took the deprecated raw-string path`);\n // also confirm it parses to an ext-owned key (typed shape)\n try {\n const key = parseContributionId(c.contributionId);\n if (key.owner !== 'ext') notes.push(`${s.name}: \"${c.contributionId}\" is not an ext-owned id`);\n } catch (err) {\n notes.push(`${s.name}: \"${c.contributionId}\" is unparseable — ${String(err)}`);\n }\n }\n }\n for (const s of negatives) {\n const ids = emitExtensionContributionSet(s.definition).contributions.map((c) => c.contributionId);\n if (!ids.some((id) => raw.has(id))) notes.push(`negative ${s.name}: expected a raw-string contributionId, none recorded`);\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C8',\n title: 'single-purpose kind — rendering kinds implement no answering port',\n disposition: 'enforced',\n open: 'Match each contribution kind against whether it provides an answering port.',\n brokenIf: 'a surface/settingsPanel also answers ops, or an answering kind provides no port.',\n run({ subjects, negatives, host }) {\n const notes: string[] = [];\n const RENDERING = new Set(['surface', 'settingsPanel']);\n const ANSWERING = new Set(['dataEndpoint', 'composerCapability', 'contextualAction']);\n const judge = (s: ConformanceSubject): string[] => {\n const local: string[] = [];\n const ctx = ctxFor(s.principal, 'k-brain');\n const ports = s.activate(host.inject(ctx, ALL_GRANTS));\n for (const c of emitExtensionContributionSet(s.definition).contributions) {\n const hasPort = ports.has(c.contributionId);\n if (RENDERING.has(c.kind) && hasPort) local.push(`${c.contributionId} (${c.kind}) provides an answering port`);\n if (ANSWERING.has(c.kind) && !hasPort) local.push(`${c.contributionId} (${c.kind}) provides NO answering port`);\n }\n return local;\n };\n for (const s of subjects) for (const n of judge(s)) notes.push(`${s.name}: ${n}`);\n for (const s of negatives) {\n if (judge(s).length === 0) notes.push(`negative ${s.name}: expected a kind/port mismatch, found none`);\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C9',\n title: 'green against InMemoryHost — the full happy path runs clean',\n disposition: 'enforced',\n open: 'Activate with correct grants and call every answering port end-to-end.',\n brokenIf: 'any conformant subject throws or returns a malformed response on the happy path.',\n async run({ subjects, host }) {\n const notes: string[] = [];\n for (const s of subjects) {\n const ctx = ctxFor(s.principal, 'k-brain');\n const grants = new Set<KernelPermissionId>(s.definition.permissions ?? []);\n try {\n const ports = s.activate(host.inject(ctx, grants));\n for (const [id, ans] of ports) {\n const out = await exercise(ans, ctx);\n if (out.response && out.response.ok !== true && out.response.ok !== false) {\n notes.push(`${s.name}/${id}: response is not a typed SeamResponse`);\n }\n }\n } catch (err) {\n notes.push(`${s.name}: happy path threw ${String(err)}`);\n }\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C10',\n title: 'every host route honours activation + gate (incl. the drain side-door)',\n disposition: 'phase5',\n open: 'Drive each op — including subscription `drain` — through the production SeamRunner for an INACTIVE principal.',\n brokenIf: 'any route (especially drain) reaches the contribution without a typed denial.',\n async run({ subjects, wiring }) {\n const { runner } = wiring;\n if (!runner) return pending('no production SeamRunner wired (Phase-5 daemon code)');\n const notes: string[] = [];\n const ops: SeamRouteOp[] = ['query', 'describe', 'invoke', 'subscribe', 'drain'];\n for (const s of subjects) {\n const ctx = ctxFor(s.principal, 'inactive-agent');\n const verdict = runner.activate(s.principal.id, ctx);\n if (verdict.ok) continue; // only meaningful when inactive\n for (const op of ops) {\n const res = await runner.route(op, { principalId: s.principal.id, contributionId: 'data.x' }, undefined, ctx);\n if (res.ok !== false) notes.push(`${s.name}: route op=\"${op}\" did NOT yield a typed denial for an inactive principal`);\n }\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C11',\n title: 'exactly one activation authority',\n disposition: 'phase5',\n open: 'Ask the SeamRunner how many independent activation sets exist.',\n brokenIf: 'the count is not exactly 1 (a parallel set like bridge-sessions inactiveExtensions).',\n run({ wiring }) {\n const { runner } = wiring;\n if (!runner) return pending('no production SeamRunner wired (Phase-5 daemon code)');\n const n = runner.activationAuthorityCount();\n return n === 1\n ? { status: 'pass', notes: [] }\n : { status: 'fail', notes: [`activationAuthorityCount()=${n}, expected exactly 1`] };\n },\n },\n {\n id: 'C12',\n title: 'scope is honoured — per-agent deactivation does not leak to other agents',\n disposition: 'phase5',\n open: 'Deactivate a principal for one agent and check another agent is still active.',\n brokenIf: \"the deactivation blocks other agents, or its scope isn't 'agent'.\",\n run({ subjects, wiring }) {\n const { runner } = wiring;\n if (!runner) return pending('no production SeamRunner wired (Phase-5 daemon code)');\n const notes: string[] = [];\n for (const s of subjects) {\n const a = runner.activate(s.principal.id, ctxFor(s.principal, 'agent-a'));\n const b = runner.activate(s.principal.id, ctxFor(s.principal, 'agent-b'));\n if (!a.ok) {\n if (a.blocked.cause === 'inactive' && a.blocked.scope !== 'agent') {\n notes.push(`${s.name}: agent-a deactivation scope=\"${a.blocked.scope}\", expected 'agent'`);\n }\n if (!b.ok) notes.push(`${s.name}: agent-a deactivation also blocked agent-b (scope leaked)`);\n }\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C13',\n title: 'builders validate ids — unknown permission/capability rejected loudly',\n disposition: 'enforced',\n open: 'Pass a bogus permission/capability id to the requires* builders.',\n brokenIf: 'an unknown id passes through silently instead of throwing.',\n async run() {\n const notes: string[] = [];\n const { requiresKernelPermissions, requiresHostCapabilities } = await import('../index.js');\n const expectThrow = (fn: () => unknown, what: string) => {\n try {\n fn();\n notes.push(`${what} did not reject an unknown id`);\n } catch {\n /* expected */\n }\n };\n expectThrow(() => requiresKernelPermissions('not.a.permission' as KernelPermissionId), 'requiresKernelPermissions');\n expectThrow(() => requiresHostCapabilities('host.not-real' as never), 'requiresHostCapabilities');\n // known ids must still pass\n try {\n requiresKernelPermissions('brain.read');\n } catch (err) {\n notes.push(`requiresKernelPermissions rejected a KNOWN id: ${String(err)}`);\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C14',\n title: 'one canonical \"none\" form for host capabilities',\n disposition: 'enforced',\n open: 'Build the same contribution three ways (omitted / [] / empty requires*) and compare the emitted capabilities.',\n brokenIf: 'the three \"no host capability\" forms do not normalize to one canonical value.',\n run() {\n const omitted = defineDataEndpoint({ ext: 'c14-probe', name: 'omitted', displayName: 'omitted' });\n const empty = defineDataEndpoint({ ext: 'c14-probe', name: 'empty', displayName: 'empty', requiredHostCapabilities: [] });\n const call = defineDataEndpoint({\n ext: 'c14-probe',\n name: 'call',\n displayName: 'call',\n requiredHostCapabilities: sdkRequiresHostCapabilities(),\n });\n const forms = [omitted, empty, call].map((c) => JSON.stringify(c.requiredHostCapabilities ?? null));\n const notes = new Set(forms).size === 1 ? [] : [`the three \"none\" forms normalize differently: ${forms.join(' | ')}`];\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C15',\n title: 'contribution ⊆ extension declarations (kernel permissions)',\n disposition: 'enforced',\n open: 'Validate the references (must pass) and a definition whose contribution requires an undeclared kernel permission (must be flagged). Host capabilities are contribution-scoped (DIV-8), not subset-checked.',\n brokenIf: 'a conformant reference is flagged, or the over-reaching contribution is NOT flagged.',\n run({ subjects, negatives, wiring }) {\n const validate = wiring.validateDefinitionCrossRefs ?? sdkValidateDefinitionCrossRefs;\n const notes: string[] = [];\n for (const s of subjects) {\n const errors = validate(s.definition);\n if (errors.length) notes.push(`${s.name}: conformant extension flagged — ${errors.join('; ')}`);\n }\n for (const s of negatives) {\n const errors = validate(s.definition);\n if (errors.length === 0) notes.push(`negative ${s.name}: over-reaching contribution was NOT flagged`);\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'C16',\n title: 'one gate model per permission domain',\n disposition: 'enforced',\n open: 'Across subjects gating composer.capabilities.invoke, compare WHERE the permission is declared.',\n brokenIf: 'the same domain is gated at the extension level by some and the contribution level by others.',\n run({ subjects, negatives }) {\n const DOMAIN: KernelPermissionId = 'composer.capabilities.invoke';\n const styleOf = (s: ConformanceSubject): 'extension' | 'contribution' | 'none' => {\n if ((s.definition.permissions ?? []).includes(DOMAIN)) return 'extension';\n const usesAtContribution = emitExtensionContributionSet(s.definition).contributions.some((c) =>\n (c.requiredKernelPermissions ?? []).includes(DOMAIN),\n );\n return usesAtContribution ? 'contribution' : 'none';\n };\n const styles = new Set(subjects.map(styleOf).filter((x) => x !== 'none'));\n const notes: string[] = [];\n if (styles.size > 1) notes.push(`conformant subjects gate ${DOMAIN} inconsistently: ${[...styles].join(' + ')}`);\n // the negative pair is built to diverge — together with a conformant subject the\n // domain must show >1 style.\n if (negatives.length) {\n const allStyles = new Set([...subjects, ...negatives].map(styleOf).filter((x) => x !== 'none'));\n if (allStyles.size <= 1) notes.push('negative pair: expected inconsistent gate models across the domain, found uniform');\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'grant-store',\n title: 'grants come from the activation authority, not a hardcoded list',\n disposition: 'phase5',\n open: 'Read a principal\\'s grants from the SeamRunner grant store.',\n brokenIf: 'grants are sourced from a startup constant rather than the per-principal store (DIV-2).',\n run({ subjects, wiring }) {\n const { runner } = wiring;\n if (!runner) return pending('no production SeamRunner / grant store wired (Phase-5 daemon code)');\n const notes: string[] = [];\n for (const s of subjects) {\n const grants = runner.grantsFor(s.principal.id, ctxFor(s.principal, 'k-brain'));\n // grants must be a per-principal set the gate can consume; presence is the contract.\n if (!(grants instanceof Set) && typeof (grants as ReadonlySet<KernelPermissionId>).has !== 'function') {\n notes.push(`${s.name}: grantsFor did not return a permission set`);\n }\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n {\n id: 'agentId-registry',\n title: 'agent id minted only for a registered, host-attested name',\n disposition: 'phase5',\n open: 'Mint an AgentId for a name that is NOT in the agent registry.',\n brokenIf: 'minting succeeds for an unregistered name (today makeAgentId rejects only blanks — HOST-N3).',\n run({ wiring }) {\n const { mintAttestedAgent, agentRegistry } = wiring;\n if (!mintAttestedAgent || !agentRegistry) return pending('no registry-aware mint wired (Phase-5 host code, HOST-N3)');\n const notes: string[] = [];\n try {\n mintAttestedAgent('definitely-not-a-registered-agent', agentRegistry);\n notes.push('minted an AgentId for an UNREGISTERED name — registry validation missing');\n } catch {\n /* expected: rejected */\n }\n // a registered name must still mint\n const known = [...agentRegistry][0];\n if (known) {\n try {\n mintAttestedAgent(known, agentRegistry);\n } catch (err) {\n notes.push(`rejected a REGISTERED name \"${known}\": ${String(err)}`);\n }\n }\n return { status: notes.length ? 'fail' : 'pass', notes };\n },\n },\n];\n\nfunction pending(reason: string): CheckOutcome {\n return { status: 'pending', notes: [reason] };\n}\n\n// ─── Runner + report ───────────────────────────────────────────────────────────\n\nexport interface ConformanceInput {\n readonly subjects: readonly ConformanceSubject[];\n readonly negatives: readonly NegativeFixture[];\n readonly wiring?: ConformanceWiring;\n /** Seed for the InMemoryHost — two agents seeded DIFFERENTLY so C2 can see variance. */\n readonly host?: InMemoryHost;\n}\n\nexport interface ConformanceReport {\n readonly verdicts: readonly CheckVerdict[];\n readonly enforcedFailures: number;\n readonly phase5Pending: number;\n readonly phase5Regressions: number;\n readonly negativeGaps: number;\n readonly ok: boolean; // process-level: enforced all green AND no phase5 regression\n}\n\nconst DEFAULT_HOST = (): InMemoryHost =>\n new InMemoryHost({\n 'k-brain': {\n entities: [\n { id: '1', title: 'Acme Corp' },\n { id: '2', title: 'Acme Holdings' },\n ],\n notes: ['kb-note-1', 'kb-note-2', 'kb-note-3'],\n },\n arcana: {\n entities: [{ id: '9', title: 'Arcana Archive' }],\n notes: ['arcana-only'],\n },\n });\n\nexport async function runConformance(input: ConformanceInput): Promise<ConformanceReport> {\n const host = input.host ?? DEFAULT_HOST();\n const wiring = input.wiring ?? {};\n const verdicts: CheckVerdict[] = [];\n\n for (const check of CHECKS) {\n const negatives = input.negatives.filter((n) => n.violates === check.id).map((n) => n.subject);\n let outcome: CheckOutcome;\n try {\n outcome = await check.run({ subjects: input.subjects, negatives, wiring, host });\n } catch (err) {\n outcome = { status: 'fail', notes: [`check threw: ${String(err)}`] };\n }\n verdicts.push({\n id: check.id,\n title: check.title,\n disposition: check.disposition,\n status: outcome.status,\n notes: outcome.notes,\n });\n }\n\n const enforcedFailures = verdicts.filter((v) => v.disposition === 'enforced' && v.status === 'fail').length;\n const phase5Pending = verdicts.filter((v) => v.disposition === 'phase5' && v.status === 'pending').length;\n const phase5Regressions = verdicts.filter((v) => v.disposition === 'phase5' && v.status === 'fail').length;\n // a phase5 check that PASSES while the suite still treats it pending is a signal to\n // promote — but with the DI-seam model a pass simply means Phase-5 wired it in, which\n // is the goal, so it is NOT a failure. Regressions (fail) are.\n const negativeGaps = 0; // negative slips are already folded into the per-check fail notes\n\n return {\n verdicts,\n enforcedFailures,\n phase5Pending,\n phase5Regressions,\n negativeGaps,\n ok: enforcedFailures === 0 && phase5Regressions === 0,\n };\n}\n\nconst ICON: Record<CheckStatus, string> = { pass: '🟢', fail: '🔴', pending: '🟡' };\n\n/** Render the visual conformance checklist (docs/61 Principle 6). */\nexport function renderReport(report: ConformanceReport, opts?: { strict?: boolean }): string {\n const lines: string[] = [];\n lines.push('');\n lines.push(' C1–C16 EXTENSION SDK CONFORMANCE (docs/65 §5)');\n lines.push(' ─────────────────────────────────────────────');\n for (const v of report.verdicts) {\n const tag = v.disposition === 'phase5' ? ' [phase5]' : '';\n lines.push(` ${ICON[v.status]} ${v.id.padEnd(16)} ${v.title}${tag}`);\n for (const n of v.notes) lines.push(` ↳ ${n}`);\n }\n lines.push(' ─────────────────────────────────────────────');\n lines.push(\n ` enforced failures: ${report.enforcedFailures} ` +\n `phase5 pending: ${report.phase5Pending} phase5 regressions: ${report.phase5Regressions}`,\n );\n const strictFail = (opts?.strict ?? false) && report.phase5Pending > 0;\n if (report.ok && !strictFail) {\n lines.push(' RESULT: GREEN — every enforced requirement holds (🟡 rows are Phase-5 targets).');\n } else {\n lines.push(' RESULT: RED — see 🔴 rows above.');\n }\n lines.push('');\n return lines.join('\\n');\n}\n","/**\n * Conformance subjects — the inputs the C1–C16 suite runs against.\n *\n * TWO distinct CONFORMANT reference extensions (docs/61 Phase-4 requirement: \"≥2\n * distinct reference extensions … design a second\"):\n * • Seam Probe — the canonical multi-channel probe: reads brain + host-context, asks\n * host-command, has a rendering surface + a data endpoint + a composer capability.\n * • Notes Lens — a deliberately DIFFERENT shape: brain-only (one declared permission),\n * a data endpoint + a contextual action (chat/invoke), no host-context/command.\n * Two different declared footprints and contribution kinds is what makes C2/C3/C8\n * non-trivial — a suite over one extension can't tell \"honours the contract\" from\n * \"happens to match this one extension\".\n *\n * Plus a NEGATIVE FIXTURE per check — a tiny extension built to FAIL exactly one\n * requirement. Without these the suite is vacuous (the Phase-3 red-team's verdict on\n * the old harness): every check here must both PASS the references AND REJECT its\n * negative.\n */\n\nimport {\n defineComposerCapability,\n defineContextualAction,\n defineDataEndpoint,\n defineExtension,\n defineSurface,\n requiresKernelPermissions,\n} from '../index.js';\nimport { clearRawContributionIdUsages } from '../contribution-id-deprecation.js';\nimport type {\n AnsweringPort,\n ComposerCapabilityPort,\n DataEndpointPort,\n HostPort,\n InvokablePort,\n SeamCallContext,\n VerifiedPrincipal,\n} from '../seam-ports.js';\nimport type { ConformanceSubject, NegativeFixture } from './conformance.js';\n\n// Build everything below from a clean deprecation registry so C7 sees ONLY the raw id\n// the rawId fixture deliberately uses (this module's defines are the only source).\nclearRawContributionIdUsages();\n\nconst principal = (id: string): VerifiedPrincipal => ({ kind: 'plugin', id, attestedBy: 'session' });\nconst strArg = (v: unknown): string => (typeof v === 'string' ? v : '');\n\n// ─── Reference #1: Seam Probe (multi-channel, conformant) ───────────────────────\n\nconst seamProbe: ConformanceSubject = {\n name: 'seam-probe',\n principal: principal('plugin.seam-probe'),\n definition: defineExtension({\n pluginId: 'plugin.seam-probe',\n displayName: 'Seam Probe',\n permissions: requiresKernelPermissions('brain.read', 'host.context.read', 'host.command.invoke'),\n surfaces: [\n defineSurface({\n ext: 'seam-probe',\n displayName: 'Seam Probe',\n requiredHostCapabilities: [],\n mount: 'web/seam-probe',\n hostSlots: ['workspace.surface'],\n }),\n ],\n dataEndpoints: [defineDataEndpoint({ ext: 'seam-probe', name: 'brain', displayName: 'Seam Probe brain' })],\n composerCapabilities: [\n defineComposerCapability({ ext: 'seam-probe', displayName: 'Seam Probe composer', requiredHostCapabilities: [] }),\n ],\n }),\n activate(host: HostPort) {\n const map = new Map<string, AnsweringPort>();\n map.set('data.seam-probe.brain', {\n async query(payload, ctx) {\n const hits = await host.brain.query(strArg(payload.filter?.q), { limit: payload.limit });\n return hits.map((h) => ({ id: h.id, title: h.title, principalId: ctx.principal.id }));\n },\n } satisfies DataEndpointPort);\n map.set('composer.seam-probe', {\n async describe() {\n return { commands: [{ commandId: 'seam-probe.ping', displayName: 'Ping host' }] };\n },\n async invoke(payload, ctx) {\n const snapshot = await host.context.snapshot(); // host.context.read\n const command = await host.command.invoke(payload.commandId, payload.args); // host.command.invoke\n return { ok: true, data: { activeAgent: snapshot.activeAgent, principalId: ctx.principal.id, command } };\n },\n } satisfies ComposerCapabilityPort);\n // surface.seam-probe is a RENDERING kind — no answering port (C8).\n return map;\n },\n identityProbe: (ctx) => ctx.principal.id,\n};\n\n// ─── Reference #2: Notes Lens (brain-only, distinct shape, conformant) ──────────\n\nconst notesLens: ConformanceSubject = {\n name: 'notes-lens',\n principal: principal('plugin.notes-lens'),\n definition: defineExtension({\n pluginId: 'plugin.notes-lens',\n displayName: 'Notes Lens',\n permissions: requiresKernelPermissions('brain.read'),\n surfaces: [\n defineSurface({\n ext: 'notes-lens',\n displayName: 'Notes Lens',\n requiredHostCapabilities: [],\n mount: 'web/notes-lens',\n hostSlots: ['workspace.surface'],\n }),\n ],\n dataEndpoints: [defineDataEndpoint({ ext: 'notes-lens', name: 'recent', displayName: 'Notes Lens recent' })],\n contextualActions: [\n defineContextualAction({\n ext: 'notes-lens',\n name: 'summarize',\n displayName: 'Summarize notes',\n requiredHostCapabilities: [],\n }),\n ],\n }),\n activate(host: HostPort) {\n const map = new Map<string, AnsweringPort>();\n map.set('data.notes-lens.recent', {\n async query(payload, ctx) {\n const hits = await host.brain.query(strArg(payload.filter?.q), { limit: payload.limit });\n const stats = await host.brain.stats();\n return [{ noteCount: stats.notes, top: hits[0]?.title ?? null, principalId: ctx.principal.id }];\n },\n } satisfies DataEndpointPort);\n map.set('contextualAction.notes-lens.summarize', {\n async invoke(payload, ctx) {\n const hits = await host.brain.query(strArg(payload.args?.q), {});\n return { ok: true, data: { summary: hits.map((h) => h.title).join(', '), principalId: ctx.principal.id } };\n },\n } satisfies InvokablePort);\n // surface.notes-lens is a RENDERING kind — no answering port (C8).\n return map;\n },\n identityProbe: (ctx) => ctx.principal.id,\n};\n\nexport const REFERENCE_EXTENSIONS: readonly ConformanceSubject[] = [seamProbe, notesLens];\n\n// ─── Negative fixtures (one per check; each must be REJECTED) ────────────────────\n\nconst emptyActivate = (): ReadonlyMap<string, AnsweringPort> => new Map();\n\n// C1: reaches PAST the injected port — returns brain-shaped data from a \"global\",\n// so it yields host data even with zero grants (it never touches the gated port).\nconst globalReach: ConformanceSubject = {\n name: 'global-reach',\n principal: principal('plugin.global-reach'),\n definition: defineExtension({\n pluginId: 'plugin.global-reach',\n displayName: 'Global Reach',\n permissions: requiresKernelPermissions('brain.read'),\n dataEndpoints: [defineDataEndpoint({ ext: 'global-reach', name: 'brain', displayName: 'GR brain' })],\n }),\n activate() {\n const map = new Map<string, AnsweringPort>();\n map.set('data.global-reach.brain', {\n async query(_payload, ctx) {\n return [{ id: 'leak', title: 'Leaked Global Row', principalId: ctx.principal.id }];\n },\n } satisfies DataEndpointPort);\n return map;\n },\n identityProbe: (ctx) => ctx.principal.id,\n};\n\n// C2: agent-blind — returns the SAME row regardless of ctx.activeAgent.\nconst agentBlind: ConformanceSubject = {\n name: 'agent-blind',\n principal: principal('plugin.agent-blind'),\n definition: defineExtension({\n pluginId: 'plugin.agent-blind',\n displayName: 'Agent Blind',\n permissions: requiresKernelPermissions('brain.read'),\n dataEndpoints: [defineDataEndpoint({ ext: 'agent-blind', name: 'brain', displayName: 'AB brain' })],\n }),\n activate() {\n const map = new Map<string, AnsweringPort>();\n map.set('data.agent-blind.brain', {\n async query(_payload, ctx) {\n return [{ id: 'const', title: 'CONSTANT', principalId: ctx.principal.id }];\n },\n } satisfies DataEndpointPort);\n return map;\n },\n identityProbe: (ctx) => ctx.principal.id,\n};\n\n// C3a: under-declared — uses brain.read but declares NO permission.\nconst underDeclared: ConformanceSubject = {\n name: 'under-declared',\n principal: principal('plugin.under-declared'),\n definition: defineExtension({\n pluginId: 'plugin.under-declared',\n displayName: 'Under Declared',\n permissions: [],\n dataEndpoints: [defineDataEndpoint({ ext: 'under-declared', name: 'brain', displayName: 'UD brain' })],\n }),\n activate(host: HostPort) {\n const map = new Map<string, AnsweringPort>();\n map.set('data.under-declared.brain', {\n async query(_payload, ctx) {\n const hits = await host.brain.query('', {});\n return hits.map((h) => ({ title: h.title, principalId: ctx.principal.id }));\n },\n } satisfies DataEndpointPort);\n return map;\n },\n identityProbe: (ctx) => ctx.principal.id,\n};\n\n// C3b: over-declared — declares host.command.invoke it never uses.\nconst overDeclared: ConformanceSubject = {\n name: 'over-declared',\n principal: principal('plugin.over-declared'),\n definition: defineExtension({\n pluginId: 'plugin.over-declared',\n displayName: 'Over Declared',\n permissions: requiresKernelPermissions('brain.read', 'host.command.invoke'),\n dataEndpoints: [defineDataEndpoint({ ext: 'over-declared', name: 'brain', displayName: 'OD brain' })],\n }),\n activate(host: HostPort) {\n const map = new Map<string, AnsweringPort>();\n map.set('data.over-declared.brain', {\n async query(_payload, ctx) {\n const hits = await host.brain.query('', {});\n return hits.map((h) => ({ title: h.title, principalId: ctx.principal.id }));\n },\n } satisfies DataEndpointPort);\n return map;\n },\n identityProbe: (ctx) => ctx.principal.id,\n};\n\n// C4: reads its identity from the (forged) payload, not ctx.principal.\nconst payloadIdentity: ConformanceSubject = {\n name: 'payload-identity',\n principal: principal('plugin.payload-identity'),\n definition: defineExtension({\n pluginId: 'plugin.payload-identity',\n displayName: 'Payload Identity',\n dataEndpoints: [defineDataEndpoint({ ext: 'payload-identity', name: 'rows', displayName: 'PI rows' })],\n }),\n activate: emptyActivate,\n identityProbe: (_ctx, forgedExtensionId) => forgedExtensionId,\n};\n\n// C7: a raw-string contributionId (the deprecated path).\nconst rawId: ConformanceSubject = {\n name: 'raw-id',\n principal: principal('plugin.raw-id'),\n definition: defineExtension({\n pluginId: 'plugin.raw-id',\n displayName: 'Raw Id',\n surfaces: [defineSurface({ contributionId: 'surface.raw-id-thing', displayName: 'Raw', requiredHostCapabilities: [] })],\n }),\n activate: emptyActivate,\n identityProbe: (ctx) => ctx.principal.id,\n};\n\n// C8: a surface (rendering kind) that ALSO answers ops.\nconst dualKind: ConformanceSubject = {\n name: 'dual-kind',\n principal: principal('plugin.dual-kind'),\n definition: defineExtension({\n pluginId: 'plugin.dual-kind',\n displayName: 'Dual Kind',\n surfaces: [\n defineSurface({ ext: 'dual-kind', displayName: 'Dual', requiredHostCapabilities: [], mount: 'web/dual' }),\n ],\n }),\n activate() {\n const map = new Map<string, AnsweringPort>();\n map.set('surface.dual-kind', {\n async query() {\n return [];\n },\n } satisfies DataEndpointPort); // a surface must NOT answer (C8)\n return map;\n },\n identityProbe: (ctx) => ctx.principal.id,\n};\n\n// C15: a contribution requiring a KERNEL PERMISSION the extension never declares — the\n// grant-authority breach (DIV-8: host capabilities are contribution-scoped and NOT\n// subset-checked; kernel permissions are the gate's grant authority and ARE).\nconst overReachContribution: ConformanceSubject = {\n name: 'over-reach-contribution',\n principal: principal('plugin.over-reach'),\n definition: defineExtension({\n pluginId: 'plugin.over-reach',\n displayName: 'Over Reach',\n permissions: [], // extension-level: declares NO kernel permissions\n dataEndpoints: [\n defineDataEndpoint({\n ext: 'over-reach',\n name: 'brain',\n displayName: 'OR brain',\n requiredKernelPermissions: ['brain.read'], // contribution-level: reaches for one ungranted\n }),\n ],\n }),\n activate: emptyActivate,\n identityProbe: (ctx) => ctx.principal.id,\n};\n\n// C16: a divergent PAIR — same composer.capabilities.invoke domain, gated at two\n// different levels (extension vs contribution).\nconst composerExtensionGated: ConformanceSubject = {\n name: 'composer-extension-gated',\n principal: principal('plugin.composer-ext-gated'),\n definition: defineExtension({\n pluginId: 'plugin.composer-ext-gated',\n displayName: 'Composer Extension Gated',\n permissions: requiresKernelPermissions('composer.capabilities.invoke'),\n composerCapabilities: [\n defineComposerCapability({ ext: 'ext-gated', displayName: 'Ext gated', requiredHostCapabilities: [] }),\n ],\n }),\n activate: emptyActivate,\n identityProbe: (ctx) => ctx.principal.id,\n};\n\nconst composerContributionGated: ConformanceSubject = {\n name: 'composer-contribution-gated',\n principal: principal('plugin.composer-contrib-gated'),\n definition: defineExtension({\n pluginId: 'plugin.composer-contrib-gated',\n displayName: 'Composer Contribution Gated',\n composerCapabilities: [\n defineComposerCapability({\n ext: 'contrib-gated',\n displayName: 'Contrib gated',\n requiredHostCapabilities: [],\n requiredKernelPermissions: ['composer.capabilities.invoke'], // gated at the WRONG level vs the pair\n }),\n ],\n }),\n activate: emptyActivate,\n identityProbe: (ctx) => ctx.principal.id,\n};\n\nexport const NEGATIVE_FIXTURES: readonly NegativeFixture[] = [\n { violates: 'C1', subject: globalReach },\n { violates: 'C2', subject: agentBlind },\n { violates: 'C3', subject: underDeclared },\n { violates: 'C3', subject: overDeclared },\n { violates: 'C4', subject: payloadIdentity },\n { violates: 'C7', subject: rawId },\n { violates: 'C8', subject: dualKind },\n { violates: 'C15', subject: overReachContribution },\n { violates: 'C16', subject: composerExtensionGated },\n { violates: 'C16', subject: composerContributionGated },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBO,IAAM,wBAAN,MAAqD;AAAA,EAC1D,YAA6B,OAA2B,CAAC,GAAG;AAA/B;AAAA,EAAgC;AAAA,EAAhC;AAAA,EAE7B,MAAM,QAAiC;AACrC,WAAO,EAAE,UAAU,KAAK,KAAK,UAAU,UAAU,GAAG,OAAO,KAAK,KAAK,OAAO,UAAU,EAAE;AAAA,EAC1F;AAAA,EAEA,MAAM,MAAM,MAAc,MAAgD;AACxE,UAAM,SAAS,KAAK,KAAK,EAAE,YAAY;AACvC,UAAM,QAAQ,KAAK,KAAK,YAAY,CAAC,GAClC,OAAO,CAAC,WAAW,OAAO,MAAM,YAAY,EAAE,SAAS,MAAM,CAAC,EAC9D,IAAI,CAAC,QAAQ,WAAW,EAAE,IAAI,OAAO,IAAI,OAAO,OAAO,OAAO,OAAO,QAAQ,IAAI,QAAQ,KAAK,QAAQ,CAAC,CAAC,EAAE,EAA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A,MACpB,yBAAyB,EAAE,KAAK,aAAa,aAAa,aAAa,0BAA0B,CAAC,EAAE,CAAC;AAAA,IACvG;AAAA,EACF,CAAC;AAAA,EACD,UAAU;AAAA,EACV,eAAe,CAAC,QAAQ,IAAI,UAAU;AACxC;AAEA,IAAM,4BAAgD;AAAA,EACpD,MAAM;AAAA,EACN,WAAW,UAAU,+BAA+B;AAAA,EACpD,YAAY,gBAAgB;AAAA,IAC1B,UAAU;AAAA,IACV,aAAa;AAAA,IACb,sBAAsB;AAAA,MACpB,yBAAyB;AAAA,QACvB,KAAK;AAAA,QACL,aAAa;AAAA,QACb,0BAA0B,CAAC;AAAA,QAC3B,2BAA2B,CAAC,8BAA8B;AAAA;AAAA,MAC5D,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAAA,EACD,UAAU;AAAA,EACV,eAAe,CAAC,QAAQ,IAAI,UAAU;AACxC;AAEO,IAAM,oBAAgD;AAAA,EAC3D,EAAE,UAAU,MAAM,SAAS,YAAY;AAAA,EACvC,EAAE,UAAU,MAAM,SAAS,WAAW;AAAA,EACtC,EAAE,UAAU,MAAM,SAAS,cAAc;AAAA,EACzC,EAAE,UAAU,MAAM,SAAS,aAAa;AAAA,EACxC,EAAE,UAAU,MAAM,SAAS,gBAAgB;AAAA,EAC3C,EAAE,UAAU,MAAM,SAAS,MAAM;AAAA,EACjC,EAAE,UAAU,MAAM,SAAS,SAAS;AAAA,EACpC,EAAE,UAAU,OAAO,SAAS,sBAAsB;AAAA,EAClD,EAAE,UAAU,OAAO,SAAS,uBAAuB;AAAA,EACnD,EAAE,UAAU,OAAO,SAAS,0BAA0B;AACxD;","names":["principal","requiresKernelPermissions","requiresHostCapabilities"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kybernesis/kyberagent-extension-sdk",
|
|
3
|
+
"version": "0.1.0-alpha",
|
|
4
|
+
"description": "KyberAgent host↔extension SDK — typed define* builders and conformance testing kit for authoring KyberAgent extensions.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./testing": {
|
|
15
|
+
"types": "./dist/testing/index.d.ts",
|
|
16
|
+
"import": "./dist/testing/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"effect": "^3.11.0"
|
|
24
|
+
}
|
|
25
|
+
}
|