@plurnk/plurnk-contracts 8.0.0 → 9.0.0
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/SPEC.md +10 -24
- package/dist/schema/DaemonNotificationEnvelope.json +555 -0
- package/dist/schema/McpServerDefinition.json +1 -1
- package/dist/schema/PlurnkStatement.json +24 -0
- package/dist/schema/ProposalProjection.json +0 -4
- package/dist/src/Application.d.ts +22 -1
- package/dist/src/Application.d.ts.map +1 -1
- package/dist/src/Application.js +480 -15
- package/dist/src/Application.js.map +1 -1
- package/dist/src/ApplicationNotifications.d.ts +59 -19
- package/dist/src/ApplicationNotifications.d.ts.map +1 -1
- package/dist/src/ApplicationNotifications.js +40 -7
- package/dist/src/ApplicationNotifications.js.map +1 -1
- package/dist/src/ApplicationPort.d.ts +26 -7
- package/dist/src/ApplicationPort.d.ts.map +1 -1
- package/dist/src/ApplicationPort.js.map +1 -1
- package/dist/src/LogRow.d.ts +1 -1
- package/dist/src/LogRow.js +1 -1
- package/dist/src/LogRow.js.map +1 -1
- package/dist/src/Validator.d.ts +3 -3
- package/dist/src/Validator.d.ts.map +1 -1
- package/dist/src/Validator.js +8 -16
- package/dist/src/Validator.js.map +1 -1
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.generated.d.ts +820 -636
- package/dist/src/types.generated.d.ts.map +1 -1
- package/dist/src/types.generated.js.map +1 -1
- package/dist/src/types.js +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +2 -2
- package/dist/schema/ApplicationOperationEvent.json +0 -27
- package/dist/schema/CapabilityDescriptor.json +0 -28
- package/dist/schema/CapabilityPolicy.json +0 -22
- package/dist/schema/CapabilityProjection.json +0 -14
- package/dist/schema/CapabilitySelector.json +0 -29
- package/dist/src/CapabilityAdmission.d.ts +0 -11
- package/dist/src/CapabilityAdmission.d.ts.map +0 -1
- package/dist/src/CapabilityAdmission.js +0 -108
- package/dist/src/CapabilityAdmission.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.js","sourceRoot":"","sources":["../../src/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAmRvC,uFAAuF;AACvF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAgE,EAAU,EAAE;IAClH,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,MAAM,WAAW,GAAG,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,MAAM,KAAK,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,WAAW,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7D,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,YAAY,MAAM,KAAK,MAAM,kBAAkB,SAAS,aAAa,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5F,OAAO;YACH,WAAW;YACX,GAAG;YACH,IAAI;YACJ,UAAU,EAAE,sBAAsB,GAAG,EAAE;YACvC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE;SAC1C,CAAC;IACN,CAAC;IACD,OAAO;QACH,WAAW;QACX,GAAG;QACH,IAAI;QACJ,UAAU;QACV,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;KAChD,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { isRecord } from \"./guards.ts\";\nimport type { DaemonNotification, DaemonNotificationEvent } from \"./ApplicationNotifications.ts\";\nimport type { LoopLifecycle } from \"./LoopLifecycle.ts\";\nimport type { LogAddressColumns } from \"./LogRow.ts\";\nimport type { Effort, JsonSchema, ModelRoute, OperationResult } from \"./types.ts\";\nimport type { RequestHeaders } from \"./HttpOrigin.ts\";\n\nexport type ProposalDecision = \"accept\" | \"reject\" | \"cancel\";\nexport type ProposalScope = \"once\" | \"always\";\n\nexport interface ApplicationOwnerIdentity {\n readonly workspaceId: number;\n readonly address: string;\n}\n\nexport interface ProposalResolution {\n readonly decision: ProposalDecision;\n readonly scope?: ProposalScope;\n readonly body?: string;\n readonly outcome?: string;\n}\n\nexport type ApplicationActionContext =\n | { readonly scope: \"daemon\" }\n | { readonly scope: \"workspace\"; readonly workspaceId: number }\n | { readonly scope: \"session\"; readonly workspaceId: number; readonly sessionId: number };\n\nexport interface ApplicationActionDescriptor {\n readonly name: string;\n readonly scope: ApplicationActionContext[\"scope\"];\n readonly inputSchema: JsonSchema;\n readonly outputSchema: JsonSchema;\n}\n\n// The bound workspace. Binding one mints nothing: a client operation journals in the workspace's\n// runtime session ({§connection-lifecycle}), and the session a thread binds is resolved separately by the\n// client-interface module.\nexport interface ClientEnvelope {\n readonly workspaceId: number;\n readonly workspaceName: string;\n readonly projectRoot: string | null;\n /** {§execution-output-identity} The folder as the daemon spells it for display; null without a folder. */\n readonly projectLabel: string | null;\n}\n\nexport type ApplicationSessionOrigin = \"model\" | \"_plurnk\";\n\n// {§application-session-observation} — `kind` is how the session was minted (a root session, a FORK\n// child with a forked log, a WORK child with a fresh log); `lifecycle` projects its representative loop\n// through the shared {§application-session-observation}, so a directory row can carry the same glyph the\n// bound session's own status gauge shows. Neither is inferred by a client.\nexport type ApplicationSessionKind = \"root\" | \"fork\" | \"work\";\nexport interface ApplicationSessionProjection {\n readonly id: number;\n readonly name: string;\n readonly created_at: string;\n readonly origin: ApplicationSessionOrigin;\n readonly owner: string;\n readonly parentSessionId: number | null;\n readonly kind: ApplicationSessionKind;\n readonly lifecycle: LoopLifecycle;\n /** {§machine-processes} When the session was archived, or null while it is unarchived. */\n readonly archived_at: string | null;\n /** {§machine-processes} Optional human-readable title set via `session/set_title`. */\n readonly title?: string | null;\n}\n\n/** {§application-session-observation} A session's latest finished reply ({§message-completion}). */\nexport interface ApplicationSessionReply {\n /** The reply's durable log row. */\n readonly id: number;\n /** Its log coordinate `L/T/S` in its session's log. */\n readonly coordinate: string;\n /** The message completion its receipt records. */\n readonly completion: 200 | 499;\n /** When it was recorded, Unix milliseconds. */\n readonly at: number;\n /** {§application-session-observation} */\n readonly excerpt: string;\n readonly continued: boolean;\n}\n\n/** {§application-session-observation} One place of the overview and what waits there. */\nexport interface ApplicationOverviewSession {\n readonly workspaceId: number;\n readonly id: number;\n readonly name: string;\n readonly parentSessionId: number | null;\n readonly kind: ApplicationSessionKind;\n readonly lifecycle: LoopLifecycle;\n /** The proposals and client interactions it waits on. */\n readonly gates: number;\n readonly reply: ApplicationSessionReply | null;\n readonly title?: string | null;\n}\n\n/** {§application-session-observation} A workspace the overview's places belong to. */\nexport interface ApplicationOverviewWorkspace {\n readonly id: number;\n readonly name: string;\n readonly projectRoot: string | null;\n /** {§execution-output-identity} */\n readonly projectLabel: string | null;\n}\n\n/** {§application-session-observation} The places in a scope, most recently finished first, and the workspaces they belong to. */\nexport interface ApplicationSessionOverview {\n readonly sessions: readonly ApplicationOverviewSession[];\n readonly workspaces: readonly ApplicationOverviewWorkspace[];\n /** The places in scope the overview leaves out. */\n readonly omitted: number;\n}\n\n/** {§machine-processes} A workspace's mark after an archive or unarchive. */\nexport interface ApplicationWorkspaceArchiving {\n readonly id: number;\n /** When the workspace was archived, or null while it is unarchived. */\n readonly archived_at: string | null;\n}\n\n/** {§machine-processes} A session's mark after an archive or unarchive. */\nexport interface ApplicationSessionArchiving {\n readonly id: number;\n /** When the session was archived, or null while it is unarchived. */\n readonly archived_at: string | null;\n /** The sessions whose mark the call changed, in id order: the group it archived or unarchived, none when nothing changed. */\n readonly sessionIds: readonly number[];\n}\n\n/** {§machine-processes} A session subtree removed by `deleteSession`. */\nexport interface ApplicationSessionDeletion {\n readonly id: number;\n /** Every session id deleted in the subtree, in id order. */\n readonly sessionIds: readonly number[];\n}\n\n/** {§machine-processes} A session's normalized title stored by `setSessionTitle`. */\nexport interface ApplicationSessionTitling {\n readonly id: number;\n readonly title: string;\n}\n\nexport interface ApplicationSessionQuery {\n readonly origin?: ApplicationSessionOrigin;\n /** Omitted means every lineage position; null means roots only. */\n readonly parentSessionId?: number | null;\n /** {§machine-processes} Omitted lists every session; true only archived ones, false only unarchived ones. */\n readonly archived?: boolean;\n}\n\nexport type ApplicationSessionIdentity =\n | { readonly id: number; readonly name?: never }\n | { readonly id?: never; readonly name: string };\n\nexport type ApplicationSessionCreation = {\n readonly workspaceId: number;\n readonly name?: string;\n} & (\n | { readonly parentSessionId: number; readonly owner?: never }\n | { readonly parentSessionId?: never; readonly owner?: string }\n);\n\nexport interface ApplicationLoopProjection {\n readonly id: number;\n readonly sessionId: number;\n readonly sequence: number;\n readonly status: number;\n readonly prompt: string;\n readonly promptSource: string | null;\n /** When the loop first ran ({§session-wait-timing}), ISO 8601 UTC; null until it has. */\n readonly claimedAt: string | null;\n /** When the loop concluded, ISO 8601 UTC; null while it is unfinished. */\n readonly terminatedAt: string | null;\n readonly terminalResult: OperationResult | null;\n /** Exact count of durable packet-bearing turns; retries and administrative turns do not contribute. */\n readonly packetCount: number;\n /** Durable observation deadline, Unix milliseconds; null outside bounded parks. */\n readonly waitUntil: number | null;\n /**\n * {§loop-completion} The operation that opened the loop, by sending its first message: its session and its log\n * address in that session's log. Null when no session's operation did, or none was recorded.\n */\n readonly invocation: { readonly sessionId: number; readonly address: string } | null;\n}\n\nexport interface ApplicationLoopPacket {\n readonly sessionId: number;\n readonly loopId: number;\n /** The loop's number among its session's loops, the L of its log coordinates. */\n readonly loopSeq: number;\n readonly packetCount: number;\n /** The loop's client gauge once this packet's turn has its call. */\n readonly gauge: ApplicationGauge;\n}\n\n/** {§tokenomics} The client gauge: a packet's curation pair and the physical pair of its emission call. */\nexport interface ApplicationGauge {\n readonly curationWeight: number | null;\n readonly curationBudget: number | null;\n readonly contextTokens: number | null;\n readonly contextCapacity: number | null;\n}\n\n// Every log entry carries its logical coordinate — loop_seq/turn_seq/sequence — so the\n// client renders ordering without re-deriving it from DB keys. {§methods-invocation}\n// A type alias, not an interface: a serialized wire bag must satisfy index-signature\n// consumers (Record<string, unknown>), which TypeScript grants aliases but not interfaces.\nexport type LogEntryWire = LogAddressColumns & {\n id: number;\n session_id: number;\n // {§methods-invocation} The session whose log holds the row, by its immutable name.\n session_name: string;\n loop_id: number;\n loop_seq: number;\n turn_id: number;\n turn_seq: number;\n sequence: number;\n at: string;\n origin: string;\n source: string | null;\n op: string | null;\n signal: unknown;\n lineMarker: unknown;\n tx: unknown;\n mimetype_tx: string;\n rx: unknown;\n mimetype_rx: string;\n status_rx: number;\n weight: number;\n attrs: unknown;\n // {§proposal} The row's lifecycle: `proposed` while its operation awaits its decision.\n state: \"proposed\" | \"resolved\" | \"failed\" | \"cancelled\";\n reasoning?: string;\n // {§methods-invocation} The request that streamed `reasoning`; absent for history a FORK inherited.\n reasoning_model_call_id?: number;\n reasoning_request_sequence?: number;\n // {§methods-invocation} On a row that discharges an obligation, the log address of the operation that opened it.\n invocation?: string;\n // {§methods-invocation} On a reply to a message this session's operation sent, the log address of that operation.\n answering?: string;\n // {§message-completion} On a reply (`send`, `done`, `fail`), the originating source/address URIs of `rx.repliedTo`.\n replied_to_sources?: readonly string[];\n};\n/** {§methods} A prompt's admission: its acknowledgement, the loop it landed on and how it landed. */\nexport type ApplicationLoopAdmission = OperationResult & {\n readonly action: \"injected_next_turn\" | \"enqueued_new_loop\";\n readonly loopId: number;\n readonly turnSeq?: number;\n};\n\n/** {§acp-status-descendants} A declared alias as the route a session seeded from it gets, its configured effort included. */\nexport type ApplicationProviderAlias = ModelRoute & {\n readonly alias: string;\n readonly active: boolean;\n readonly inputCapacity: number | null;\n};\n\n/** {§startup-admission} Result of an explicit operator-triggered model catalog refresh. */\nexport interface ApplicationServiceUpdateResult {\n readonly catalog: {\n readonly status: \"updated\" | \"unchanged\";\n readonly providers: number;\n readonly models: number;\n readonly addedModels: number;\n readonly updatedAt: string;\n readonly path: string;\n };\n readonly service: {\n readonly package: string;\n readonly version: string;\n readonly artifact: \"source\" | \"dist\";\n readonly upgradeCommand: string;\n };\n}\n\n/** {§startup-admission} Formats an operator-triggered model catalog refresh result. */\nexport const formatServiceUpdateReport = (result: ApplicationServiceUpdateResult | Record<string, unknown>): string => {\n const cat = isRecord(result.catalog) ? result.catalog : {};\n const svc = isRecord(result.service) ? result.service : {};\n const addedModels = typeof cat.addedModels === \"number\" ? cat.addedModels : 0;\n const added = addedModels > 0 ? `, +${addedModels} new` : \"\";\n const status = typeof cat.status === \"string\" ? cat.status : \"updated\";\n const models = typeof cat.models === \"number\" ? cat.models : 0;\n const providers = typeof cat.providers === \"number\" ? cat.providers : 0;\n const catLine = `catalog: ${status} (${models} models across ${providers} providers${added})`;\n const suffix = svc.artifact === \"source\" ? \" (source checkout)\" : \"\";\n const pkg = typeof svc.package === \"string\" ? svc.package : \"@plurnk/plurnk-service\";\n const ver = typeof svc.version === \"string\" ? svc.version : \"\";\n const upgradeCmd = typeof svc.upgradeCommand === \"string\"\n ? svc.upgradeCommand\n : \"npm install -g --ignore-scripts @plurnk/plurnk-service@latest @plurnk/plurnk@latest\";\n const verLine = `version: ${pkg}@${ver}${suffix} — to update packages, stop the daemon and run: ${upgradeCmd}`;\n return `${catLine}\\n${verLine}`;\n};\n\nexport interface ParsedFamilyCommand {\n readonly scopePrefix: \"workspace\" | \"session\";\n readonly sub: string;\n readonly rest: readonly string[];\n readonly actionName: string;\n readonly params: Record<string, unknown>;\n}\n\n/** {§acp-action-binding} Parses a family command (`mcp`, `skills`, `personas`, `env`, `schedule`) into its action kind and parameters. */\nexport const parseFamilyCommand = (family: string, args: readonly string[]): ParsedFamilyCommand => {\n let scopePrefix: \"workspace\" | \"session\" = family === \"env\" ? \"session\" : \"workspace\";\n const filteredArgs: string[] = [];\n for (let i = 0; i < args.length; i += 1) {\n const tok = args[i] ?? \"\";\n if (tok === \"--scope\" && args[i + 1] !== undefined) {\n scopePrefix = args[i + 1] === \"workspace\" ? \"workspace\" : \"session\";\n i += 1;\n continue;\n }\n if (tok.startsWith(\"--scope=\")) {\n scopePrefix = tok.slice(\"--scope=\".length) === \"workspace\" ? \"workspace\" : \"session\";\n continue;\n }\n if (tok.length > 0) {\n filteredArgs.push(tok);\n }\n }\n const rawSub = filteredArgs[0] ?? \"list\";\n const sub = family === \"env\" && rawSub === \"set\"\n ? \"add\"\n : family === \"env\" && rawSub === \"unset\"\n ? \"remove\"\n : rawSub;\n const rest = filteredArgs.slice(1);\n const actionName = `${scopePrefix}.${family}.${sub}`;\n\n if (sub === \"list\") {\n return { scopePrefix, sub, rest, actionName, params: {} };\n }\n if (sub === \"discover\") {\n let sourceFlag: string | undefined;\n let queryFlag: string | undefined;\n let ruleFlag: string | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if (tok === \"--source\" && rest[i + 1] !== undefined) {\n sourceFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--source=\")) {\n sourceFlag = tok.slice(\"--source=\".length);\n } else if (tok === \"--query\" && rest[i + 1] !== undefined) {\n queryFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--query=\")) {\n queryFlag = tok.slice(\"--query=\".length);\n } else if (tok === \"--rule\" && rest[i + 1] !== undefined) {\n ruleFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--rule=\")) {\n ruleFlag = tok.slice(\"--rule=\".length);\n } else {\n posArgs.push(tok);\n }\n }\n if (sourceFlag !== undefined || queryFlag !== undefined || ruleFlag !== undefined) {\n return {\n scopePrefix,\n sub,\n rest,\n actionName,\n params: {\n ...(sourceFlag !== undefined ? { source: sourceFlag } : {}),\n ...(queryFlag !== undefined ? { query: queryFlag } : {}),\n ...(ruleFlag !== undefined ? { rule: ruleFlag } : {}),\n },\n };\n }\n const query = posArgs.join(\" \");\n return {\n scopePrefix,\n sub,\n rest,\n actionName,\n params: query.length === 0\n ? {}\n : family === \"skills\"\n ? { source: query }\n : family === \"schedule\"\n ? { rule: query }\n : { query },\n };\n }\n if (sub === \"enable\" || sub === \"disable\" || sub === \"remove\") {\n const target = rest[0] ?? \"\";\n return {\n scopePrefix,\n sub,\n rest,\n actionName,\n params: family === \"members\" ? { file: target } : { alias: target },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"mcp\") {\n const alias = rest[0] ?? \"\";\n const target = rest[1] ?? \"\";\n const extraArgs = rest.slice(2);\n const params = /^https?:\\/\\//iu.test(target)\n ? { alias, type: \"streamable-http\", url: target }\n : {\n alias,\n type: \"stdio\",\n command: target,\n ...(extraArgs.length > 0 ? { args: extraArgs } : {}),\n };\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.mcp.${sub}`,\n params,\n };\n }\n if (sub === \"skills\" && family === \"mcp\") {\n const server = rest[0] ?? \"\";\n const skill = rest[1];\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.skills\",\n params: {\n server,\n ...(skill !== undefined && skill.length > 0 ? { skill } : {}),\n },\n };\n }\n if (sub === \"oauth\" && family === \"mcp\") {\n const alias = rest[0] ?? \"\";\n const callbackUrl = rest[1];\n if (callbackUrl !== undefined && callbackUrl.length > 0) {\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.oauth.complete\",\n params: { alias, callbackUrl },\n };\n }\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.oauth.begin\",\n params: { alias, redirectUrl: \"http://127.0.0.1/callback\" },\n };\n }\n if (sub === \"complete\" && family === \"mcp\") {\n let server = \"\";\n let ref: Record<string, string> = { type: \"ref/prompt\", name: \"\" };\n let argTokens: readonly string[] = [];\n const uriMatch = /^([a-z0-9_-]+):\\/\\/\\/(prompts|resources)\\/(.+)$/iu.exec(rest[0] ?? \"\");\n if (uriMatch) {\n server = uriMatch[1] ?? \"\";\n const kind = (uriMatch[2] ?? \"\").toLowerCase();\n const target = decodeURIComponent(uriMatch[3] ?? \"\");\n ref = kind === \"resources\"\n ? { type: \"ref/resource\", uri: target }\n : { type: \"ref/prompt\", name: target };\n argTokens = rest.slice(1);\n } else {\n server = rest[0] ?? \"\";\n const rawKind = (rest[1] ?? \"prompt\").toLowerCase();\n const target = rest[2] ?? \"\";\n ref = rawKind === \"resource\" || rawKind === \"ref/resource\"\n ? { type: \"ref/resource\", uri: target }\n : { type: \"ref/prompt\", name: target };\n argTokens = rest.slice(3);\n }\n const firstArg = argTokens[0] ?? \"\";\n const eqIdx = firstArg.indexOf(\"=\");\n const argument = eqIdx >= 0\n ? { name: firstArg.slice(0, eqIdx), value: firstArg.slice(eqIdx + 1) }\n : { name: firstArg, value: argTokens[1] ?? \"\" };\n const contextArgs: Record<string, string> = {};\n for (const extra of argTokens.slice(eqIdx >= 0 ? 1 : 2)) {\n const cEq = extra.indexOf(\"=\");\n if (cEq > 0) {\n contextArgs[extra.slice(0, cEq)] = extra.slice(cEq + 1);\n }\n }\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.complete\",\n params: {\n server,\n ref,\n argument,\n ...(Object.keys(contextArgs).length > 0 ? { context: { arguments: contextArgs } } : {}),\n },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"skills\") {\n let ref: string | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if (tok === \"--ref\" && rest[i + 1] !== undefined) {\n ref = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--ref=\")) {\n ref = tok.slice(\"--ref=\".length);\n } else {\n posArgs.push(tok);\n }\n }\n const alias = posArgs[0] ?? \"\";\n const source = posArgs[1] ?? \"\";\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.skills.${sub}`,\n params: {\n alias,\n source,\n ...(ref !== undefined ? { ref } : {}),\n },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"personas\") {\n let source: string | undefined;\n let model: string | undefined;\n let effort: string | undefined;\n let description: string | undefined;\n let body: string | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if (tok === \"--source\" && rest[i + 1] !== undefined) {\n source = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--source=\")) {\n source = tok.slice(\"--source=\".length);\n } else if (tok === \"--model\" && rest[i + 1] !== undefined) {\n model = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--model=\")) {\n model = tok.slice(\"--model=\".length);\n } else if (tok === \"--effort\" && rest[i + 1] !== undefined) {\n effort = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--effort=\")) {\n effort = tok.slice(\"--effort=\".length);\n } else if (tok === \"--description\" && rest[i + 1] !== undefined) {\n description = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--description=\")) {\n description = tok.slice(\"--description=\".length);\n } else if (tok === \"--body\" && rest[i + 1] !== undefined) {\n body = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--body=\")) {\n body = tok.slice(\"--body=\".length);\n } else {\n posArgs.push(tok);\n }\n }\n const alias = posArgs[0] ?? \"\";\n const secondArg = posArgs[1];\n const looksLikePath = source === undefined\n && posArgs.length === 2\n && secondArg !== undefined\n && (secondArg.endsWith(\".md\") || secondArg.includes(\"/\") || secondArg.includes(\"\\\\\"));\n const resolvedSource = source ?? (looksLikePath ? secondArg : undefined);\n const resolvedDescription = description ?? (resolvedSource === undefined ? secondArg : undefined);\n const resolvedBody = body ?? (resolvedSource === undefined && posArgs.length > 2 ? posArgs.slice(2).join(\" \") : undefined);\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.personas.${sub}`,\n params: {\n alias,\n ...(resolvedSource !== undefined ? { source: resolvedSource } : {}),\n ...(resolvedDescription !== undefined ? { description: resolvedDescription } : {}),\n ...(resolvedBody !== undefined ? { body: resolvedBody } : {}),\n ...(model !== undefined ? { model } : {}),\n ...(effort !== undefined ? { effort } : {}),\n },\n };\n }\n if (sub === \"add\" && family === \"members\") {\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.members.add\",\n params: { files: rest },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"env\") {\n const first = rest[0] ?? \"\";\n const eqIdx = rest.length === 1 ? first.indexOf(\"=\") : -1;\n const alias = eqIdx > 0 ? first.slice(0, eqIdx) : first;\n const value = eqIdx > 0 ? first.slice(eqIdx + 1) : rest.slice(1).join(\" \");\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `${scopePrefix}.env.${sub}`,\n params: { alias, value },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"schedule\") {\n const alias = rest[0] ?? \"\";\n const sessionArg = rest[1] ?? \"\";\n const rule = rest[2] ?? \"\";\n const prompt = rest.slice(3).join(\" \");\n const target = sessionArg.startsWith(\"session://\") ? sessionArg : `session://${sessionArg}`;\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.schedule.${sub}`,\n params: { alias, rule, target, prompt },\n };\n }\n return {\n scopePrefix,\n sub,\n rest,\n actionName,\n params: rest.length > 0 ? { args: rest } : {},\n };\n};\n\nexport type ApplicationEventHandler = (\n workspaceId: number | null,\n method: DaemonNotificationEvent,\n params: unknown,\n notification: DaemonNotification,\n) => void;\n\n/**\n * {§credential-authority} The kind of a credential: an access token is presented as a bearer; a\n * refresh token is exchanged for new credentials of its family and is never presented; a session\n * is a browser's standing at the authorization server ({§auth-oauth-clients}), never a bearer.\n */\nexport type CredentialKind = \"access\" | \"refresh\" | \"session\";\n\n/**\n * {§credential-authority} What an issued credential stands for. `family` names the grant it descends\n * from: revocation is by family, so an access token and the refresh token that renews it fall together.\n */\nexport interface CredentialClaims {\n readonly kind: CredentialKind;\n readonly subject: string;\n readonly clientId: string;\n readonly scopes: readonly string[];\n readonly family: string;\n readonly expiresAt: number;\n}\n\nexport interface IssuedCredential {\n readonly token: string;\n readonly expiresAt: number;\n}\n\n/**\n * {§credential-authority} The issuing face of the authority, published by the module that issues:\n * the issuer origin where a request's caller obtains credentials, or, asked with no request in hand,\n * the configured issuer or the listener's own origin; answered from the moment it is published\n * ({§http-host}). Published, the daemon authenticates; absent, every mounted resource\n * admits anonymously.\n */\nexport interface CredentialFace {\n readonly issuer: (req?: RequestHeaders) => string;\n}\n\n/**\n * {§credential-authority} A live browser sign-in: the family every credential of that sign-in shares,\n * which is its handle and never a credential; whose it is; when it was established; when the last\n * of its session credentials expires; and the clients holding credentials in it. Never a token.\n */\nexport interface CredentialSession {\n readonly family: string;\n readonly subject: string;\n readonly createdAt: number;\n readonly expiresAt: number;\n readonly clients: readonly string[];\n}\n\n/**\n * {§credential-authority} The confidential client a module of this daemon registers for itself at\n * setup: its id, the absolute pathnames under its own mounts it may be answered at, the scopes it may\n * ask for and, optionally, the pathname of a stylesheet it serves for the authority's documents shown\n * to its requests ({§auth-oauth-clients}). The issuer supplies the origin of each. What others may\n * know of it; never its secret.\n */\nexport interface ModuleClient {\n readonly id: string;\n readonly redirectPaths: readonly string[];\n readonly scopes: readonly string[];\n readonly stylesheetPath?: string;\n}\n\n/**\n * {§credential-authority} {§auth-oauth-clients} A dynamically registered RFC 7591 public OAuth 2.1\n * client persisted alongside the authority's encrypted grants across daemon restarts.\n */\nexport interface PublicOAuthClient {\n readonly id: string;\n readonly scopes: readonly string[];\n readonly redirectUris: readonly string[];\n readonly name: string | null;\n}\n\n/**\n * {§credential-authority} The daemon's one authority over the credentials presented to its listener:\n * opaque tokens it issued, live until they expire, are consumed, or their family or secret is revoked.\n * Every exterior adapter verifies through it; the client protocol is its issuing face.\n */\nexport interface CredentialAuthority {\n /**\n * The operator's client secret, `PLURNK_SECRET` when set, else the durable host secret beside\n * the database (or minted in memory when headless); null when the daemon authenticates nothing\n * (`PLURNK_AUTH=0`) and no credential exists.\n */\n readonly operatorSecret: string | null;\n issue(credential: Omit<CredentialClaims, \"expiresAt\"> & { readonly ttlMs: number }): IssuedCredential;\n /** The claims of a live credential; null for one unknown, expired, consumed or revoked. */\n verify(token: string): CredentialClaims | null;\n /**\n * Retires a live refresh token in exchange for new credentials of its family. A token already\n * retired is a reuse: its whole family is revoked and named; anything else answers null.\n */\n consume(token: string): { readonly claims: CredentialClaims } | { readonly reusedFamily: string | null };\n revokeFamily(family: string): void;\n onRevoked(listener: (family: string) => void): () => void;\n /** {§credential-authority} The live browser sign-ins of `subject`, oldest first; never a token. */\n sessions(subject: string): readonly CredentialSession[];\n /**\n * Registers the calling module's own confidential client and answers its secret, minted for\n * this boot, held in memory and told to nobody else. A second registration of one id is a fault.\n */\n registerClient(client: ModuleClient): { readonly clientId: string; readonly clientSecret: string };\n /** A module's registered client, without its secret; null for an id no module registered. */\n client(id: string): ModuleClient | null;\n /** Whether `secret` is the one minted for the module client `id`, compared in constant time. */\n authenticateClient(id: string, secret: string): boolean;\n /** {§auth-oauth-clients} Persists a dynamically registered RFC 7591 public client across restarts. */\n registerPublicClient?(client: PublicOAuthClient): void;\n /** {§auth-oauth-clients} Dynamically registered RFC 7591 public clients restored at boot. */\n publicClients?(): readonly PublicOAuthClient[];\n /**\n * {§auth-oauth-clients} Retains persisted credentials only for `allowedClientIds` (plus registered\n * module clients), revoking any family whose client was removed from configuration before restart.\n */\n retainClients?(allowedClientIds: ReadonlySet<string>): void;\n /** Publishes the one issuing face; a second publication is a configuration fault. */\n publish(face: CredentialFace): void;\n /** The published face, or null while nothing issues: the daemon authenticates nothing. */\n face(): CredentialFace | null;\n}\n\nexport interface ApplicationPersonaProjection {\n readonly name: string;\n readonly description: string;\n readonly body: string;\n readonly source: string;\n readonly model?: string;\n readonly effort?: Effort;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Application.js","sourceRoot":"","sources":["../../src/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAuRvC,uFAAuF;AACvF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAgE,EAAU,EAAE;IAClH,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,MAAM,WAAW,GAAG,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,MAAM,KAAK,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,WAAW,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7D,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,MAAM,MAAM,GAAG,OAAO,GAAG,CAA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CAAC;IACD,MAAM,KAAK,GAAsB,aAAa,IAAI,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACzG,MAAM,UAAU,GAAG,KAAK,KAAK,QAAQ;QACjC,CAAC,CAAC,6DAA6D;QAC/D,CAAC,CAAC,gCAAgC,CAAC;IACvC,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjD,MAAM,UAAU,GACZ,oGAAoG,UAAU,KAAK;QACnH,mKAAmK,CAAC;IACxK,OAAO;QACH,EAAE,EAAE,IAAI;QACR,KAAK;QACL,MAAM,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,cAAc,YAAY,EAAE,CAAC,CAAC,CAAC,UAAU;KAC3F,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { isRecord } from \"./guards.ts\";\nimport type { DaemonNotification, DaemonNotificationEvent } from \"./ApplicationNotifications.ts\";\nimport type { LoopLifecycle } from \"./LoopLifecycle.ts\";\nimport type { LogAddressColumns } from \"./LogRow.ts\";\nimport type { Effort, JsonSchema, ModelRoute, OperationResult } from \"./types.ts\";\nimport type { RequestHeaders } from \"./HttpOrigin.ts\";\n\nexport type ProposalDecision = \"accept\" | \"reject\" | \"cancel\";\nexport type ProposalScope = \"once\" | \"always\";\n\nexport interface ApplicationOwnerIdentity {\n readonly workspaceId: number;\n readonly address: string;\n}\n\nexport interface ProposalResolution {\n readonly decision: ProposalDecision;\n readonly scope?: ProposalScope;\n readonly body?: string;\n readonly outcome?: string;\n}\n\nexport type ApplicationActionContext =\n | { readonly scope: \"daemon\" }\n | { readonly scope: \"workspace\"; readonly workspaceId: number }\n | { readonly scope: \"session\"; readonly workspaceId: number; readonly sessionId: number };\n\nexport interface ApplicationActionDescriptor {\n readonly name: string;\n readonly scope: ApplicationActionContext[\"scope\"];\n readonly inputSchema: JsonSchema;\n readonly outputSchema: JsonSchema;\n}\n\n// The bound workspace. Binding one mints nothing: a client operation journals in the workspace's\n// runtime session ({§connection-lifecycle}), and the session a thread binds is resolved separately by the\n// client-interface module.\nexport interface ClientEnvelope {\n readonly workspaceId: number;\n readonly workspaceName: string;\n readonly projectRoot: string | null;\n /** {§execution-output-identity} The folder as the daemon spells it for display; null without a folder. */\n readonly projectLabel: string | null;\n}\n\nexport type ApplicationSessionOrigin = \"model\" | \"_plurnk\";\n\n// {§application-session-observation} — `kind` is how the session was minted (a root session, a FORK\n// child with a forked log, a WORK child with a fresh log); `lifecycle` projects its representative loop\n// through the shared {§application-session-observation}, so a directory row can carry the same glyph the\n// bound session's own status gauge shows. Neither is inferred by a client.\nexport type ApplicationSessionKind = \"root\" | \"fork\" | \"work\";\nexport interface ApplicationSessionProjection {\n readonly id: number;\n readonly name: string;\n readonly created_at: string;\n readonly origin: ApplicationSessionOrigin;\n readonly owner: string;\n readonly parentSessionId: number | null;\n readonly kind: ApplicationSessionKind;\n readonly lifecycle: LoopLifecycle;\n /** {§machine-processes} When the session was archived, or null while it is unarchived. */\n readonly archived_at: string | null;\n /** {§machine-processes} Optional human-readable title set via `session/set_title`. */\n readonly title?: string | null;\n /** {§persona-discovery} Durable workspace persona bound to this session, or null when unset. */\n readonly persona?: string | null;\n}\n\n/** {§application-session-observation} A session's latest finished reply ({§message-completion}). */\nexport interface ApplicationSessionReply {\n /** The reply's durable log row. */\n readonly id: number;\n /** Its log coordinate `L/T/S` in its session's log. */\n readonly coordinate: string;\n /** The message completion its receipt records. */\n readonly completion: 200 | 499;\n /** When it was recorded, Unix milliseconds. */\n readonly at: number;\n /** {§application-session-observation} */\n readonly excerpt: string;\n readonly continued: boolean;\n}\n\n/** {§application-session-observation} One place of the overview and what waits there. */\nexport interface ApplicationOverviewSession {\n readonly workspaceId: number;\n readonly id: number;\n readonly name: string;\n readonly parentSessionId: number | null;\n readonly kind: ApplicationSessionKind;\n readonly lifecycle: LoopLifecycle;\n /** The proposals and client interactions it waits on. */\n readonly gates: number;\n readonly reply: ApplicationSessionReply | null;\n readonly title?: string | null;\n readonly persona?: string | null;\n}\n\n/** {§application-session-observation} A workspace the overview's places belong to. */\nexport interface ApplicationOverviewWorkspace {\n readonly id: number;\n readonly name: string;\n readonly projectRoot: string | null;\n /** {§execution-output-identity} */\n readonly projectLabel: string | null;\n}\n\n/** {§application-session-observation} The places in a scope, most recently finished first, and the workspaces they belong to. */\nexport interface ApplicationSessionOverview {\n readonly sessions: readonly ApplicationOverviewSession[];\n readonly workspaces: readonly ApplicationOverviewWorkspace[];\n /** The places in scope the overview leaves out. */\n readonly omitted: number;\n}\n\n/** {§machine-processes} A workspace's mark after an archive or unarchive. */\nexport interface ApplicationWorkspaceArchiving {\n readonly id: number;\n /** When the workspace was archived, or null while it is unarchived. */\n readonly archived_at: string | null;\n}\n\n/** {§machine-processes} A session's mark after an archive or unarchive. */\nexport interface ApplicationSessionArchiving {\n readonly id: number;\n /** When the session was archived, or null while it is unarchived. */\n readonly archived_at: string | null;\n /** The sessions whose mark the call changed, in id order: the group it archived or unarchived, none when nothing changed. */\n readonly sessionIds: readonly number[];\n}\n\n/** {§machine-processes} A session subtree removed by `deleteSession`. */\nexport interface ApplicationSessionDeletion {\n readonly id: number;\n /** Every session id deleted in the subtree, in id order. */\n readonly sessionIds: readonly number[];\n}\n\n/** {§machine-processes} A session's normalized title stored by `setSessionTitle`. */\nexport interface ApplicationSessionTitling {\n readonly id: number;\n readonly title: string;\n}\n\nexport interface ApplicationSessionQuery {\n readonly origin?: ApplicationSessionOrigin;\n /** Omitted means every lineage position; null means roots only. */\n readonly parentSessionId?: number | null;\n /** {§machine-processes} Omitted lists every session; true only archived ones, false only unarchived ones. */\n readonly archived?: boolean;\n}\n\nexport type ApplicationSessionIdentity =\n | { readonly id: number; readonly name?: never }\n | { readonly id?: never; readonly name: string };\n\nexport type ApplicationSessionCreation = {\n readonly workspaceId: number;\n readonly name?: string;\n readonly persona?: string | null;\n} & (\n | { readonly parentSessionId: number; readonly owner?: never }\n | { readonly parentSessionId?: never; readonly owner?: string }\n);\n\nexport interface ApplicationLoopProjection {\n readonly id: number;\n readonly sessionId: number;\n readonly sequence: number;\n readonly status: number;\n readonly prompt: string;\n readonly promptSource: string | null;\n /** When the loop first ran ({§session-wait-timing}), ISO 8601 UTC; null until it has. */\n readonly claimedAt: string | null;\n /** When the loop concluded, ISO 8601 UTC; null while it is unfinished. */\n readonly terminatedAt: string | null;\n readonly terminalResult: OperationResult | null;\n /** Exact count of durable packet-bearing turns; retries and administrative turns do not contribute. */\n readonly packetCount: number;\n /** Durable observation deadline, Unix milliseconds; null outside bounded parks. */\n readonly waitUntil: number | null;\n /**\n * {§loop-completion} The operation that opened the loop, by sending its first message: its session and its log\n * address in that session's log. Null when no session's operation did, or none was recorded.\n */\n readonly invocation: { readonly sessionId: number; readonly address: string } | null;\n}\n\nexport interface ApplicationLoopPacket {\n readonly sessionId: number;\n readonly loopId: number;\n /** The loop's number among its session's loops, the L of its log coordinates. */\n readonly loopSeq: number;\n readonly packetCount: number;\n /** The loop's client gauge once this packet's turn has its call. */\n readonly gauge: ApplicationGauge;\n}\n\n/** {§tokenomics} The client gauge: a packet's curation pair and the physical pair of its emission call. */\nexport interface ApplicationGauge {\n readonly curationWeight: number | null;\n readonly curationBudget: number | null;\n readonly contextTokens: number | null;\n readonly contextCapacity: number | null;\n}\n\n// Every log entry carries its logical coordinate — loop_seq/turn_seq/sequence — so the\n// client renders ordering without re-deriving it from DB keys. {§methods-invocation}\n// A type alias, not an interface: a serialized wire bag must satisfy index-signature\n// consumers (Record<string, unknown>), which TypeScript grants aliases but not interfaces.\nexport type LogEntryWire = LogAddressColumns & {\n id: number;\n session_id: number;\n // {§methods-invocation} The session whose log holds the row, by its immutable name.\n session_name: string;\n loop_id: number;\n loop_seq: number;\n turn_id: number;\n turn_seq: number;\n sequence: number;\n at: string;\n origin: string;\n source: string | null;\n op: string | null;\n signal: unknown;\n lineMarker: unknown;\n tx: unknown;\n mimetype_tx: string;\n rx: unknown;\n mimetype_rx: string;\n status_rx: number;\n weight: number;\n attrs: unknown;\n // {§proposal} The row's lifecycle: `proposed` while its operation awaits its decision.\n state: \"proposed\" | \"resolved\" | \"failed\" | \"cancelled\";\n reasoning?: string;\n // {§methods-invocation} The request that streamed `reasoning`; absent for history a FORK inherited.\n reasoning_model_call_id?: number;\n reasoning_request_sequence?: number;\n // {§methods-invocation} On a row that discharges an obligation, the log address of the operation that opened it.\n invocation?: string;\n // {§methods-invocation} On a reply to a message this session's operation sent, the log address of that operation.\n answering?: string;\n // {§message-completion} On a reply (`send`, `done`, `fail`), the originating source/address URIs of `rx.repliedTo`.\n replied_to_sources?: readonly string[];\n};\n/** {§methods} A prompt's admission: its acknowledgement, the loop it landed on and how it landed. */\nexport type ApplicationLoopAdmission = OperationResult & {\n readonly action: \"injected_next_turn\" | \"enqueued_new_loop\";\n readonly loopId: number;\n readonly turnSeq?: number;\n};\n\n/** {§acp-status-descendants} A declared alias as the route a session seeded from it gets, its configured effort included. */\nexport type ApplicationProviderAlias = ModelRoute & {\n readonly alias: string;\n readonly active: boolean;\n readonly inputCapacity: number | null;\n};\n\n/** {§startup-admission} Result of an explicit operator-triggered model catalog refresh. */\nexport interface ApplicationServiceUpdateResult {\n readonly catalog: {\n readonly status: \"updated\" | \"unchanged\";\n readonly providers: number;\n readonly models: number;\n readonly addedModels: number;\n readonly updatedAt: string;\n readonly path: string;\n };\n readonly service: {\n readonly package: string;\n readonly version: string;\n readonly artifact: \"source\" | \"dist\";\n readonly upgradeCommand: string;\n };\n}\n\n/** {§startup-admission} Formats an operator-triggered model catalog refresh result. */\nexport const formatServiceUpdateReport = (result: ApplicationServiceUpdateResult | Record<string, unknown>): string => {\n const cat = isRecord(result.catalog) ? result.catalog : {};\n const svc = isRecord(result.service) ? result.service : {};\n const addedModels = typeof cat.addedModels === \"number\" ? cat.addedModels : 0;\n const added = addedModels > 0 ? `, +${addedModels} new` : \"\";\n const status = typeof cat.status === \"string\" ? cat.status : \"updated\";\n const models = typeof cat.models === \"number\" ? cat.models : 0;\n const providers = typeof cat.providers === \"number\" ? cat.providers : 0;\n const catLine = `catalog: ${status} (${models} models across ${providers} providers${added})`;\n const suffix = svc.artifact === \"source\" ? \" (source checkout)\" : \"\";\n const pkg = typeof svc.package === \"string\" ? svc.package : \"@plurnk/plurnk-service\";\n const ver = typeof svc.version === \"string\" ? svc.version : \"\";\n const upgradeCmd = typeof svc.upgradeCommand === \"string\"\n ? svc.upgradeCommand\n : \"npm install -g --ignore-scripts @plurnk/plurnk-service@latest @plurnk/plurnk@latest\";\n const verLine = `version: ${pkg}@${ver}${suffix} — to update packages, stop the daemon and run: ${upgradeCmd}`;\n return `${catLine}\\n${verLine}`;\n};\n\nexport interface ParsedFamilyCommand {\n readonly scopePrefix: \"workspace\" | \"session\";\n readonly sub: string;\n readonly rest: readonly string[];\n readonly actionName: string;\n readonly params: Record<string, unknown>;\n}\n\n/** {§acp-action-binding} Parses a family command (`mcp`, `skills`, `personas`, `members`, `env`, `schedule`) into its action kind and parameters. */\nexport const parseFamilyCommand = (family: string, args: readonly string[]): ParsedFamilyCommand => {\n let scopePrefix: \"workspace\" | \"session\" = family === \"env\" ? \"session\" : \"workspace\";\n const filteredArgs: string[] = [];\n for (let i = 0; i < args.length; i += 1) {\n const tok = args[i] ?? \"\";\n if (tok === \"--scope\" && args[i + 1] !== undefined) {\n scopePrefix = args[i + 1] === \"workspace\" ? \"workspace\" : \"session\";\n i += 1;\n continue;\n }\n if (tok.startsWith(\"--scope=\")) {\n scopePrefix = tok.slice(\"--scope=\".length) === \"workspace\" ? \"workspace\" : \"session\";\n continue;\n }\n if (tok.length > 0) {\n filteredArgs.push(tok);\n }\n }\n const rawSub = filteredArgs[0] ?? \"list\";\n const sub = family === \"env\" && rawSub === \"set\"\n ? \"replace\"\n : family === \"env\" && rawSub === \"unset\"\n ? \"remove\"\n : rawSub;\n const rest = filteredArgs.slice(1);\n const actionName = `${scopePrefix}.${family}.${sub}`;\n\n if (sub === \"list\") {\n return { scopePrefix, sub, rest, actionName, params: {} };\n }\n if (sub === \"discover\") {\n let sourceFlag: string | undefined;\n let queryFlag: string | undefined;\n let ruleFlag: string | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if (tok === \"--source\" && rest[i + 1] !== undefined) {\n sourceFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--source=\")) {\n sourceFlag = tok.slice(\"--source=\".length);\n } else if (tok === \"--query\" && rest[i + 1] !== undefined) {\n queryFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--query=\")) {\n queryFlag = tok.slice(\"--query=\".length);\n } else if (tok === \"--rule\" && rest[i + 1] !== undefined) {\n ruleFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--rule=\")) {\n ruleFlag = tok.slice(\"--rule=\".length);\n } else {\n posArgs.push(tok);\n }\n }\n if (sourceFlag !== undefined || queryFlag !== undefined || ruleFlag !== undefined) {\n return {\n scopePrefix,\n sub,\n rest,\n actionName,\n params: {\n ...(sourceFlag !== undefined ? { source: sourceFlag } : {}),\n ...(queryFlag !== undefined ? { query: queryFlag } : {}),\n ...(ruleFlag !== undefined ? { rule: ruleFlag } : {}),\n },\n };\n }\n const query = posArgs.join(\" \");\n return {\n scopePrefix,\n sub,\n rest,\n actionName,\n params: query.length === 0\n ? {}\n : family === \"skills\" || family === \"personas\"\n ? { source: query }\n : family === \"schedule\"\n ? { rule: query }\n : { query },\n };\n }\n if (sub === \"enable\" || sub === \"disable\" || sub === \"remove\") {\n const target = rest[0] ?? \"\";\n return {\n scopePrefix,\n sub,\n rest,\n actionName,\n params: family === \"members\" ? { file: target } : { alias: target },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"mcp\") {\n let urlFlag: string | undefined;\n let commandFlag: string | undefined;\n const argFlags: string[] = [];\n const envObj: Record<string, string> = {};\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if (tok === \"--url\" && rest[i + 1] !== undefined) {\n urlFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--url=\")) {\n urlFlag = tok.slice(\"--url=\".length);\n } else if (tok === \"--command\" && rest[i + 1] !== undefined) {\n commandFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--command=\")) {\n commandFlag = tok.slice(\"--command=\".length);\n } else if (tok === \"--arg\" && rest[i + 1] !== undefined) {\n argFlags.push(rest[i + 1] ?? \"\");\n i += 1;\n } else if (tok.startsWith(\"--arg=\")) {\n argFlags.push(tok.slice(\"--arg=\".length));\n } else if (tok === \"--env\" && rest[i + 1] !== undefined) {\n const pair = rest[i + 1] ?? \"\";\n const eq = pair.indexOf(\"=\");\n if (eq > 0) envObj[pair.slice(0, eq)] = pair.slice(eq + 1);\n i += 1;\n } else if (tok.startsWith(\"--env=\")) {\n const pair = tok.slice(\"--env=\".length);\n const eq = pair.indexOf(\"=\");\n if (eq > 0) envObj[pair.slice(0, eq)] = pair.slice(eq + 1);\n } else {\n posArgs.push(tok);\n }\n }\n const alias = posArgs[0] ?? \"\";\n const target = urlFlag ?? commandFlag ?? posArgs[1] ?? \"\";\n const extraArgs = argFlags.length > 0 ? argFlags : posArgs.slice(2);\n const params = /^https?:\\/\\//iu.test(target)\n ? { alias, type: \"streamable-http\", url: target }\n : {\n alias,\n type: \"stdio\",\n command: target,\n ...(extraArgs.length > 0 ? { args: extraArgs } : {}),\n ...(Object.keys(envObj).length > 0 ? { env: envObj } : {}),\n };\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.mcp.${sub}`,\n params,\n };\n }\n if (sub === \"skills\" && family === \"mcp\") {\n let serverFlag: string | undefined;\n let skillFlag: string | undefined;\n let includeFiles: boolean | undefined;\n let verify: boolean | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if ((tok === \"--server\" || tok === \"--alias\") && rest[i + 1] !== undefined) {\n serverFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--server=\")) {\n serverFlag = tok.slice(\"--server=\".length);\n } else if (tok.startsWith(\"--alias=\")) {\n serverFlag = tok.slice(\"--alias=\".length);\n } else if (tok === \"--skill\" && rest[i + 1] !== undefined) {\n skillFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--skill=\")) {\n skillFlag = tok.slice(\"--skill=\".length);\n } else if (tok === \"--include-files\") {\n includeFiles = true;\n } else if (tok === \"--verify\") {\n verify = true;\n } else {\n posArgs.push(tok);\n }\n }\n const server = serverFlag ?? posArgs[0] ?? \"\";\n const skill = skillFlag ?? (serverFlag !== undefined ? posArgs[0] : posArgs[1]);\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.skills\",\n params: {\n server,\n ...(skill !== undefined && skill.length > 0 ? { skill } : {}),\n ...(includeFiles === true ? { includeFiles: true } : {}),\n ...(verify === true ? { verify: true } : {}),\n },\n };\n }\n if (sub === \"oauth\" && family === \"mcp\") {\n const alias = rest[0] ?? \"\";\n const callbackUrl = rest[1];\n if (callbackUrl !== undefined && callbackUrl.length > 0) {\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.oauth.complete\",\n params: { alias, callbackUrl },\n };\n }\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.oauth.begin\",\n params: { alias, redirectUrl: \"http://127.0.0.1/callback\" },\n };\n }\n if (sub === \"complete\" && family === \"mcp\") {\n let serverFlag: string | undefined;\n let promptFlag: string | undefined;\n let uriFlag: string | undefined;\n let nameFlag: string | undefined;\n let valueFlag: string | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if ((tok === \"--server\" || tok === \"--alias\") && rest[i + 1] !== undefined) {\n serverFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--server=\")) {\n serverFlag = tok.slice(\"--server=\".length);\n } else if (tok.startsWith(\"--alias=\")) {\n serverFlag = tok.slice(\"--alias=\".length);\n } else if (tok === \"--prompt\" && rest[i + 1] !== undefined) {\n promptFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--prompt=\")) {\n promptFlag = tok.slice(\"--prompt=\".length);\n } else if (tok === \"--uri\" && rest[i + 1] !== undefined) {\n uriFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--uri=\")) {\n uriFlag = tok.slice(\"--uri=\".length);\n } else if (tok === \"--name\" && rest[i + 1] !== undefined) {\n nameFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--name=\")) {\n nameFlag = tok.slice(\"--name=\".length);\n } else if (tok === \"--value\" && rest[i + 1] !== undefined) {\n valueFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--value=\")) {\n valueFlag = tok.slice(\"--value=\".length);\n } else {\n posArgs.push(tok);\n }\n }\n if (promptFlag !== undefined || uriFlag !== undefined || nameFlag !== undefined || valueFlag !== undefined || serverFlag !== undefined) {\n const server = serverFlag ?? posArgs[0] ?? \"\";\n const remPos = serverFlag !== undefined ? posArgs : posArgs.slice(1);\n const ref = promptFlag !== undefined\n ? { type: \"ref/prompt\", name: promptFlag }\n : { type: \"ref/resource\", uri: uriFlag ?? \"\" };\n const argument = {\n name: nameFlag ?? remPos[0] ?? \"\",\n value: valueFlag ?? remPos[1] ?? \"\",\n };\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.complete\",\n params: { server, ref, argument },\n };\n }\n let server = \"\";\n let ref: Record<string, string> = { type: \"ref/prompt\", name: \"\" };\n let argTokens: readonly string[] = [];\n const uriMatch = /^([a-z0-9_-]+):\\/\\/\\/(prompts|resources)\\/(.+)$/iu.exec(rest[0] ?? \"\");\n if (uriMatch) {\n server = uriMatch[1] ?? \"\";\n const kind = (uriMatch[2] ?? \"\").toLowerCase();\n const target = decodeURIComponent(uriMatch[3] ?? \"\");\n ref = kind === \"resources\"\n ? { type: \"ref/resource\", uri: target }\n : { type: \"ref/prompt\", name: target };\n argTokens = rest.slice(1);\n } else {\n server = rest[0] ?? \"\";\n const rawKind = (rest[1] ?? \"prompt\").toLowerCase();\n const target = rest[2] ?? \"\";\n ref = rawKind === \"resource\" || rawKind === \"ref/resource\"\n ? { type: \"ref/resource\", uri: target }\n : { type: \"ref/prompt\", name: target };\n argTokens = rest.slice(3);\n }\n const firstArg = argTokens[0] ?? \"\";\n const eqIdx = firstArg.indexOf(\"=\");\n const argument = eqIdx >= 0\n ? { name: firstArg.slice(0, eqIdx), value: firstArg.slice(eqIdx + 1) }\n : { name: firstArg, value: argTokens[1] ?? \"\" };\n const contextArgs: Record<string, string> = {};\n for (const extra of argTokens.slice(eqIdx >= 0 ? 1 : 2)) {\n const cEq = extra.indexOf(\"=\");\n if (cEq > 0) {\n contextArgs[extra.slice(0, cEq)] = extra.slice(cEq + 1);\n }\n }\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.mcp.complete\",\n params: {\n server,\n ref,\n argument,\n ...(Object.keys(contextArgs).length > 0 ? { context: { arguments: contextArgs } } : {}),\n },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"skills\") {\n let sourceFlag: string | undefined;\n let ref: string | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if (tok === \"--source\" && rest[i + 1] !== undefined) {\n sourceFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--source=\")) {\n sourceFlag = tok.slice(\"--source=\".length);\n } else if (tok === \"--ref\" && rest[i + 1] !== undefined) {\n ref = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--ref=\")) {\n ref = tok.slice(\"--ref=\".length);\n } else {\n posArgs.push(tok);\n }\n }\n const alias = posArgs[0] ?? \"\";\n const source = sourceFlag ?? posArgs[1] ?? \"\";\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.skills.${sub}`,\n params: {\n alias,\n source,\n ...(ref !== undefined ? { ref } : {}),\n },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"personas\") {\n let source: string | undefined;\n let model: string | undefined;\n let effort: string | undefined;\n let description: string | undefined;\n let body: string | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if (tok === \"--source\" && rest[i + 1] !== undefined) {\n source = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--source=\")) {\n source = tok.slice(\"--source=\".length);\n } else if (tok === \"--model\" && rest[i + 1] !== undefined) {\n model = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--model=\")) {\n model = tok.slice(\"--model=\".length);\n } else if (tok === \"--effort\" && rest[i + 1] !== undefined) {\n effort = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--effort=\")) {\n effort = tok.slice(\"--effort=\".length);\n } else if (tok === \"--description\" && rest[i + 1] !== undefined) {\n description = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--description=\")) {\n description = tok.slice(\"--description=\".length);\n } else if (tok === \"--body\" && rest[i + 1] !== undefined) {\n body = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--body=\")) {\n body = tok.slice(\"--body=\".length);\n } else {\n posArgs.push(tok);\n }\n }\n const alias = posArgs[0] ?? \"\";\n const secondArg = posArgs[1];\n const looksLikePath = source === undefined\n && posArgs.length === 2\n && secondArg !== undefined\n && (secondArg.endsWith(\".md\") || secondArg.includes(\"/\") || secondArg.includes(\"\\\\\"));\n const resolvedSource = source ?? (looksLikePath ? secondArg : undefined);\n const resolvedDescription = description ?? (resolvedSource === undefined ? secondArg : undefined);\n const resolvedBody = body ?? (resolvedSource === undefined && posArgs.length > 2 ? posArgs.slice(2).join(\" \") : undefined);\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.personas.${sub}`,\n params: {\n alias,\n ...(resolvedSource !== undefined ? { source: resolvedSource } : {}),\n ...(resolvedDescription !== undefined ? { description: resolvedDescription } : {}),\n ...(resolvedBody !== undefined ? { body: resolvedBody } : {}),\n ...(model !== undefined ? { model } : {}),\n ...(effort !== undefined ? { effort } : {}),\n },\n };\n }\n if (sub === \"add\" && family === \"members\") {\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.members.add\",\n params: { files: rest },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"env\") {\n const first = rest[0] ?? \"\";\n const eqIdx = rest.length === 1 ? first.indexOf(\"=\") : -1;\n const alias = eqIdx > 0 ? first.slice(0, eqIdx) : first;\n const value = eqIdx > 0 ? first.slice(eqIdx + 1) : rest.slice(1).join(\" \");\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `${scopePrefix}.env.${sub}`,\n params: { alias, value },\n };\n }\n if (sub === \"run\" && family === \"schedule\") {\n const alias = rest[0] ?? \"\";\n return {\n scopePrefix,\n sub,\n rest,\n actionName: \"workspace.schedule.run\",\n params: { alias },\n };\n }\n if ((sub === \"done\" || sub === \"reopen\" || sub === \"open\") && family === \"schedule\") {\n const alias = rest[0] ?? \"\";\n const status = sub === \"done\" ? \"done\" : \"open\";\n return {\n scopePrefix,\n sub: \"status\",\n rest,\n actionName: \"workspace.schedule.status\",\n params: { alias, status },\n };\n }\n if ((sub === \"add\" || sub === \"replace\") && family === \"schedule\") {\n let ruleFlag: string | undefined;\n let runFlag: string | undefined;\n let targetFlag: string | undefined;\n let promptFlag: string | undefined;\n let personaFlag: string | undefined;\n let catchupFlag: boolean | undefined;\n const posArgs: string[] = [];\n for (let i = 0; i < rest.length; i += 1) {\n const tok = rest[i] ?? \"\";\n if (tok === \"--rule\" && rest[i + 1] !== undefined) {\n ruleFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--rule=\")) {\n ruleFlag = tok.slice(\"--rule=\".length);\n } else if (tok === \"--run\" && rest[i + 1] !== undefined) {\n runFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--run=\")) {\n runFlag = tok.slice(\"--run=\".length);\n } else if (tok === \"--target\" && rest[i + 1] !== undefined) {\n targetFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--target=\")) {\n targetFlag = tok.slice(\"--target=\".length);\n } else if (tok === \"--prompt\" && rest[i + 1] !== undefined) {\n promptFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--prompt=\")) {\n promptFlag = tok.slice(\"--prompt=\".length);\n } else if (tok === \"--persona\" && rest[i + 1] !== undefined) {\n personaFlag = rest[i + 1];\n i += 1;\n } else if (tok.startsWith(\"--persona=\")) {\n personaFlag = tok.slice(\"--persona=\".length);\n } else if (tok === \"--catchup\") {\n catchupFlag = true;\n } else if (tok === \"--no-catchup\") {\n catchupFlag = false;\n } else {\n posArgs.push(tok);\n }\n }\n const normalizeRuleArg = (raw: string | undefined): string | null =>\n raw === undefined || raw === \"null\" || raw === \"none\" ? null : raw;\n if (runFlag !== undefined) {\n const alias = posArgs[0] ?? \"\";\n const rawRule = ruleFlag ?? posArgs[1];\n const normalizedTarget = targetFlag === undefined\n ? undefined\n : targetFlag.startsWith(\"session://\") ? targetFlag : `session://${targetFlag}`;\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.schedule.${sub}`,\n params: {\n alias,\n rule: normalizeRuleArg(rawRule),\n run: runFlag,\n ...(normalizedTarget !== undefined ? { target: normalizedTarget } : {}),\n ...(catchupFlag !== undefined ? { catchup: catchupFlag } : {}),\n },\n };\n }\n const alias = posArgs[0] ?? \"\";\n const sessionArg = targetFlag ?? posArgs[1] ?? \"\";\n const rawRule = ruleFlag ?? posArgs[2] ?? \"\";\n const prompt = promptFlag !== undefined\n ? promptFlag\n : targetFlag !== undefined && ruleFlag !== undefined\n ? posArgs.slice(1).join(\" \")\n : posArgs.slice(3).join(\" \");\n const target = sessionArg.startsWith(\"session://\") ? sessionArg : `session://${sessionArg}`;\n const rule = rawRule === \"null\" || rawRule === \"none\" ? null : rawRule;\n return {\n scopePrefix,\n sub,\n rest,\n actionName: `workspace.schedule.${sub}`,\n params: {\n alias,\n rule,\n target,\n prompt,\n ...(personaFlag !== undefined ? { persona: personaFlag } : {}),\n ...(catchupFlag !== undefined ? { catchup: catchupFlag } : {}),\n },\n };\n }\n return {\n scopePrefix,\n sub,\n rest,\n actionName,\n params: rest.length > 0 ? { args: rest } : {},\n };\n};\n\n/** {§acp-action-binding} Formats definition rows for `list` and multi-definition `members` mutations across CLI, ACP, and Web. */\nexport const formatFamilyRows = (family: string, result: Readonly<Record<string, unknown>>): string => {\n const definitions = Array.isArray(result.definitions)\n ? result.definitions\n : Array.isArray(result.items)\n ? result.items\n : [];\n if (definitions.length === 0) {\n return `${family}: none\\n`;\n }\n const lines: string[] = [];\n for (const item of definitions) {\n if (!isRecord(item)) {\n lines.push(String(item));\n continue;\n }\n const alias = typeof item.alias === \"string\"\n ? item.alias\n : typeof item.name === \"string\"\n ? item.name\n : \"\";\n const state = typeof item.state === \"string\" ? item.state : \"active\";\n const def = isRecord(item.definition) ? item.definition : {};\n const detail = isRecord(item.detail) ? item.detail : {};\n const type = typeof def.type === \"string\" ? def.type : \"\";\n const target =\n typeof def.command === \"string\"\n ? def.command\n : typeof def.url === \"string\"\n ? def.url\n : typeof def.source === \"string\"\n ? def.source\n : typeof def.value === \"string\"\n ? def.value\n : family === \"schedule\"\n ? [\n typeof detail.status === \"string\" ? `status=${detail.status}` : \"\",\n typeof def.rule === \"string\" ? def.rule : def.rule === null ? \"unscheduled\" : \"\",\n typeof def.target === \"string\"\n ? def.target\n : typeof def.run === \"string\"\n ? \"run\"\n : \"\",\n ]\n .filter((p) => p.length > 0)\n .join(\" \")\n : family === \"members\"\n ? [\n typeof detail.effect === \"string\" ? detail.effect : \"\",\n typeof detail.matched === \"number\" ? `matched=${String(detail.matched)}` : \"\",\n ]\n .filter((p) => p.length > 0)\n .join(\" \")\n : typeof def.description === \"string\"\n ? def.description\n : \"\";\n const extra =\n family === \"personas\"\n ? [\n typeof def.model === \"string\" && def.model.length > 0 ? `model=${def.model}` : \"\",\n typeof def.effort === \"string\" && def.effort.length > 0 ? `effort=${def.effort}` : \"\",\n ]\n .filter((p) => p.length > 0)\n .join(\" \")\n : \"\";\n const prov = isRecord(item.provenance) ? item.provenance : {};\n const source = typeof prov.source === \"string\" && prov.source.length > 0 ? `source=${prov.source}` : \"\";\n const rowParts = [alias, state, type, target, extra, source].filter((p) => p.length > 0);\n lines.push(rowParts.join(\" \"));\n }\n return `${lines.join(\"\\n\")}\\n`;\n};\n\n/** {§acp-action-binding} Formats any family action result (`list`, `discover`, `add`, `replace`, `remove`, `enable`, `disable`, `skills`, `complete`, `oauth`, `run`, `status`) into structured human-readable text. */\nexport const formatFamilyResult = (\n family: string,\n actionName: string,\n params: Readonly<Record<string, unknown>>,\n result: unknown,\n): string => {\n if (!isRecord(result)) {\n return `Executed /${family}`;\n }\n if (actionName === \"workspace.mcp.oauth.begin\" || actionName === \"workspace.mcp.oauth.complete\") {\n const alias = typeof result.alias === \"string\"\n ? result.alias\n : typeof params.alias === \"string\"\n ? params.alias\n : \"\";\n if (isRecord(result.authorization) && typeof result.authorization.url === \"string\") {\n return `${alias}: authorization required: ${result.authorization.url}`;\n }\n if (result.status === 202) {\n return `${alias}: Sign-in accepted; tools awaiting activation.`;\n }\n if (result.status === 200) {\n return `${alias} active`;\n }\n }\n if (isRecord(result.completion) && Array.isArray(result.completion.values)) {\n const values = result.completion.values.filter((v): v is string => typeof v === \"string\");\n return values.length === 0 ? `${family} complete: none` : values.join(\"\\n\");\n }\n if (actionName === \"workspace.mcp.skills\") {\n if (result.found === false) {\n return \"mcp skills: none\";\n }\n if (isRecord(result.skill) && typeof result.skill.name === \"string\") {\n return `${result.skill.name} verified`;\n }\n if (Array.isArray(result.skills)) {\n if (result.skills.length === 0) return \"mcp skills: none\";\n return result.skills\n .map((item) => {\n if (!isRecord(item)) return String(item);\n const name = typeof item.name === \"string\" ? item.name : \"\";\n const summary = typeof item.description === \"string\" && item.description.length > 0\n ? ` ${item.description}`\n : \"\";\n return `${name}${summary}`;\n })\n .join(\"\\n\");\n }\n }\n if (Array.isArray(result.candidates)) {\n if (result.candidates.length === 0) {\n return `${family} discover: none`;\n }\n return result.candidates\n .map((item) => {\n if (!isRecord(item)) return String(item);\n const alias = typeof item.alias === \"string\" && item.alias.length > 0 ? item.alias : \"\";\n const summary = typeof item.summary === \"string\" && item.summary.length > 0 ? item.summary : \"\";\n return alias.length > 0 && summary.length > 0\n ? `${alias} ${summary}`\n : alias.length > 0\n ? alias\n : summary;\n })\n .join(\"\\n\");\n }\n if (result.removed === true && typeof result.alias === \"string\") {\n return `${result.alias} removed`;\n }\n if (isRecord(result.definition) && typeof result.definition.alias === \"string\") {\n return formatFamilyRows(family, { definitions: [result.definition] }).trimEnd();\n }\n if (Array.isArray(result.definitions) || Array.isArray(result.items)) {\n return formatFamilyRows(family, result).trimEnd();\n }\n return `Executed /${family}`;\n};\n\nexport type LearnCommandScope = \"project\" | \"plurnk\";\nexport type LearnCommandExpansion =\n | { readonly ok: true; readonly scope: LearnCommandScope; readonly prompt: string }\n | { readonly ok: false; readonly error: string };\n\n/** {§acp-action-binding} Expands `/learn [--scope project|plurnk] [instructions]` with folder-aware skill target resolution. */\nexport const expandLearnCommand = (\n rawLine: string,\n options?: { readonly projectRoot?: string | null },\n): LearnCommandExpansion | null => {\n const trimmed = rawLine.trim();\n if (trimmed !== \"/learn\" && !trimmed.startsWith(\"/learn \")) {\n return null;\n }\n const restText = trimmed.slice(\"/learn\".length).trim();\n const tokens = restText.length > 0 ? restText.split(/\\s+/u) : [];\n let explicitScope: string | undefined;\n const instructionTokens: string[] = [];\n for (let i = 0; i < tokens.length; i += 1) {\n const tok = tokens[i] ?? \"\";\n if (tok === \"--scope\") {\n const next = tokens[i + 1];\n if (next === undefined || next.startsWith(\"--\")) {\n return { ok: false, error: \"Missing /learn --scope value: expected 'project' or 'plurnk'.\" };\n }\n explicitScope = next;\n i += 1;\n } else if (tok.startsWith(\"--scope=\")) {\n explicitScope = tok.slice(\"--scope=\".length);\n } else {\n instructionTokens.push(tok);\n }\n }\n if (explicitScope !== undefined && explicitScope !== \"project\" && explicitScope !== \"plurnk\") {\n return {\n ok: false,\n error: `Invalid /learn scope '${explicitScope}': expected 'project' or 'plurnk'.`,\n };\n }\n if (explicitScope === \"project\" && options?.projectRoot === null) {\n return {\n ok: false,\n error: \"This workspace has no project folder; use `/learn --scope plurnk` to save under $XDG_CONFIG_HOME/plurnk/skills.\",\n };\n }\n const scope: LearnCommandScope = explicitScope ?? (options?.projectRoot === null ? \"plurnk\" : \"project\");\n const targetPath = scope === \"plurnk\"\n ? \"${XDG_CONFIG_HOME:-~/.config}/plurnk/skills/<name>/SKILL.md\"\n : \".agents/skills/<name>/SKILL.md\";\n const instructions = instructionTokens.join(\" \");\n const basePrompt =\n `Distill reusable workflow, setup, or domain knowledge from this session into an Agent Skill at \\`${targetPath}\\` ` +\n \"(read `mcp:///plurnk/skills.json` first, write a concise `SKILL.md` with YAML frontmatter `name` and `description`, and verify discovery with the `skills` tool).\";\n return {\n ok: true,\n scope,\n prompt: instructions.length > 0 ? `${basePrompt}\\n\\nFocus: ${instructions}` : basePrompt,\n };\n};\n\nexport type ApplicationEventHandler = (\n workspaceId: number | null,\n method: DaemonNotificationEvent,\n params: unknown,\n notification: DaemonNotification,\n) => void;\n\n/**\n * {§credential-authority} The kind of a credential: an access token is presented as a bearer; a\n * refresh token is exchanged for new credentials of its family and is never presented; a session\n * is a browser's standing at the authorization server ({§auth-oauth-clients}), never a bearer.\n */\nexport type CredentialKind = \"access\" | \"refresh\" | \"session\";\n\n/**\n * {§credential-authority} What an issued credential stands for. `family` names the grant it descends\n * from: revocation is by family, so an access token and the refresh token that renews it fall together.\n */\nexport interface CredentialClaims {\n readonly kind: CredentialKind;\n readonly subject: string;\n readonly clientId: string;\n readonly scopes: readonly string[];\n readonly family: string;\n readonly expiresAt: number;\n}\n\nexport interface IssuedCredential {\n readonly token: string;\n readonly expiresAt: number;\n}\n\n/**\n * {§credential-authority} The issuing face of the authority, published by the module that issues:\n * the issuer origin where a request's caller obtains credentials, or, asked with no request in hand,\n * the configured issuer or the listener's own origin; answered from the moment it is published\n * ({§http-host}). Published, the daemon authenticates; absent, every mounted resource\n * admits anonymously.\n */\nexport interface CredentialFace {\n readonly issuer: (req?: RequestHeaders) => string;\n}\n\n/**\n * {§credential-authority} A live browser sign-in: the family every credential of that sign-in shares,\n * which is its handle and never a credential; whose it is; when it was established; when the last\n * of its session credentials expires; and the clients holding credentials in it. Never a token.\n */\nexport interface CredentialSession {\n readonly family: string;\n readonly subject: string;\n readonly createdAt: number;\n readonly expiresAt: number;\n readonly clients: readonly string[];\n}\n\n/**\n * {§credential-authority} The confidential client a module of this daemon registers for itself at\n * setup: its id, the absolute pathnames under its own mounts it may be answered at, the scopes it may\n * ask for and, optionally, the pathname of a stylesheet it serves for the authority's documents shown\n * to its requests ({§auth-oauth-clients}). The issuer supplies the origin of each. What others may\n * know of it; never its secret.\n */\nexport interface ModuleClient {\n readonly id: string;\n readonly redirectPaths: readonly string[];\n readonly scopes: readonly string[];\n readonly stylesheetPath?: string;\n}\n\n/**\n * {§credential-authority} {§auth-oauth-clients} A dynamically registered RFC 7591 public OAuth 2.1\n * client persisted alongside the authority's encrypted grants across daemon restarts.\n */\nexport interface PublicOAuthClient {\n readonly id: string;\n readonly scopes: readonly string[];\n readonly redirectUris: readonly string[];\n readonly name: string | null;\n}\n\n/**\n * {§credential-authority} The daemon's one authority over the credentials presented to its listener:\n * opaque tokens it issued, live until they expire, are consumed, or their family or secret is revoked.\n * Every exterior adapter verifies through it; the client protocol is its issuing face.\n */\nexport interface CredentialAuthority {\n /**\n * The operator's client secret, `PLURNK_SECRET` when set, else the durable host secret beside\n * the database (or minted in memory when headless); null when the daemon authenticates nothing\n * (`PLURNK_AUTH=0`) and no credential exists.\n */\n readonly operatorSecret: string | null;\n issue(credential: Omit<CredentialClaims, \"expiresAt\"> & { readonly ttlMs: number }): IssuedCredential;\n /** The claims of a live credential; null for one unknown, expired, consumed or revoked. */\n verify(token: string): CredentialClaims | null;\n /**\n * Retires a live refresh token in exchange for new credentials of its family. A token already\n * retired is a reuse: its whole family is revoked and named; anything else answers null.\n */\n consume(token: string): { readonly claims: CredentialClaims } | { readonly reusedFamily: string | null };\n revokeFamily(family: string): void;\n onRevoked(listener: (family: string) => void): () => void;\n /** {§credential-authority} The live browser sign-ins of `subject`, oldest first; never a token. */\n sessions(subject: string): readonly CredentialSession[];\n /**\n * Registers the calling module's own confidential client and answers its secret, minted for\n * this boot, held in memory and told to nobody else. A second registration of one id is a fault.\n */\n registerClient(client: ModuleClient): { readonly clientId: string; readonly clientSecret: string };\n /** A module's registered client, without its secret; null for an id no module registered. */\n client(id: string): ModuleClient | null;\n /** Whether `secret` is the one minted for the module client `id`, compared in constant time. */\n authenticateClient(id: string, secret: string): boolean;\n /** {§auth-oauth-clients} Persists a dynamically registered RFC 7591 public client across restarts. */\n registerPublicClient?(client: PublicOAuthClient): void;\n /** {§auth-oauth-clients} Dynamically registered RFC 7591 public clients restored at boot. */\n publicClients?(): readonly PublicOAuthClient[];\n /**\n * {§auth-oauth-clients} Retains persisted credentials only for `allowedClientIds` (plus registered\n * module clients), revoking any family whose client was removed from configuration before restart.\n */\n retainClients?(allowedClientIds: ReadonlySet<string>): void;\n /** Publishes the one issuing face; a second publication is a configuration fault. */\n publish(face: CredentialFace): void;\n /** The published face, or null while nothing issues: the daemon authenticates nothing. */\n face(): CredentialFace | null;\n}\n\nexport interface ApplicationPersonaProjection {\n readonly name: string;\n readonly description: string;\n readonly body: string;\n readonly source: string;\n readonly model?: string;\n readonly effort?: Effort;\n}\n"]}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import type { ApplicationLoopPacket, ApplicationSessionArchiving, ApplicationSessionDeletion, ApplicationSessionKind, ApplicationSessionOrigin, ApplicationSessionTitling, ApplicationWorkspaceArchiving, LogEntryWire } from "./Application.ts";
|
|
1
|
+
import type { ApplicationLoopPacket, ApplicationSessionArchiving, ApplicationSessionDeletion, ApplicationSessionKind, ApplicationSessionOrigin, ApplicationSessionTitling, ApplicationWorkspaceArchiving, LogEntryWire, ProposalDecision } from "./Application.ts";
|
|
2
2
|
import type { LoopLifecycle } from "./LoopLifecycle.ts";
|
|
3
|
-
import type { ClientEntryChannel, ClientInteractionProjection, FunctionalityPreparationActivity, JsonSchema, ModelRoute, Notice, OperationResult,
|
|
3
|
+
import type { ClientEntryChannel, ClientInteractionProjection, FunctionalityPreparationActivity, JsonSchema, ModelRoute, Notice, OperationResult, ProposalProjection } from "./types.ts";
|
|
4
4
|
import type { ProviderAccounting } from "./types.generated.ts";
|
|
5
5
|
/**
|
|
6
|
-
* {§application-session-observation} The closed alphabet of daemon notification events
|
|
7
|
-
* across `ApplicationPort.subscribeToEvents` and `GET /notifications`.
|
|
6
|
+
* {§application-session-observation} The closed alphabet of discrete daemon notification events
|
|
7
|
+
* emitted across `ApplicationPort.subscribeToEvents` and `GET /notifications`.
|
|
8
8
|
*/
|
|
9
|
-
export declare const DAEMON_NOTIFICATION_EVENTS: readonly ["workspace/created", "workspace/renamed", "workspace/archived", "
|
|
9
|
+
export declare const DAEMON_NOTIFICATION_EVENTS: readonly ["workspace/created", "workspace/renamed", "workspace/archived", "functionality/changed", "session/created", "session/archived", "session/deleted", "session/titled", "session/policy", "loop/proposal", "loop/interaction", "loop/gate-settled", "loop/terminated", "log/entry", "stream/concluded", "notice/event"];
|
|
10
10
|
export type DaemonNotificationEvent = (typeof DAEMON_NOTIFICATION_EVENTS)[number];
|
|
11
11
|
export declare const isDaemonNotificationEvent: (value: unknown) => value is DaemonNotificationEvent;
|
|
12
|
+
/**
|
|
13
|
+
* {§application-session-observation} In-process sub-turn streaming and telemetry callbacks
|
|
14
|
+
* consumed by exterior protocol adapters (`plurnk-acp`, `plurnk-mcp`), never streamed on `GET /notifications`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const APPLICATION_RUNTIME_STREAM_EVENTS: readonly ["workspace/preparation", "loop/packet", "stream/event", "reasoning/event", "runtime/telemetry"];
|
|
17
|
+
export type ApplicationRuntimeStreamEvent = (typeof APPLICATION_RUNTIME_STREAM_EVENTS)[number];
|
|
18
|
+
export declare const isApplicationRuntimeStreamEvent: (value: unknown) => value is ApplicationRuntimeStreamEvent;
|
|
19
|
+
/**
|
|
20
|
+
* {§notifications} Classifies internal turn/lifecycle/derivation/progress telemetry notices that belong
|
|
21
|
+
* on `ApplicationPort.subscribeToRuntimeStream` (`runtime/telemetry`) rather than public `notice/event`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const isRuntimeTelemetryNotice: (notice: Notice) => boolean;
|
|
12
24
|
export interface WorkspaceCreatedNotification {
|
|
13
25
|
readonly id: number;
|
|
14
26
|
readonly name: string;
|
|
@@ -24,6 +36,11 @@ export interface WorkspacePreparationNotification {
|
|
|
24
36
|
readonly workspaceId: number;
|
|
25
37
|
readonly preparation: readonly FunctionalityPreparationActivity[];
|
|
26
38
|
}
|
|
39
|
+
export interface FunctionalityChangedNotification {
|
|
40
|
+
readonly workspaceId: number;
|
|
41
|
+
readonly sessionId: number | null;
|
|
42
|
+
readonly family: string;
|
|
43
|
+
}
|
|
27
44
|
export interface SessionCreatedNotification {
|
|
28
45
|
readonly id: number;
|
|
29
46
|
readonly workspaceId: number;
|
|
@@ -35,6 +52,7 @@ export interface SessionCreatedNotification {
|
|
|
35
52
|
readonly origin: ApplicationSessionOrigin;
|
|
36
53
|
readonly kind: ApplicationSessionKind;
|
|
37
54
|
readonly lifecycle: LoopLifecycle;
|
|
55
|
+
readonly persona?: string | null;
|
|
38
56
|
}
|
|
39
57
|
export type SessionArchivedNotification = ApplicationSessionArchiving;
|
|
40
58
|
export type SessionDeletedNotification = ApplicationSessionDeletion;
|
|
@@ -43,6 +61,7 @@ export interface SessionPolicyNotification {
|
|
|
43
61
|
readonly sessionId: number;
|
|
44
62
|
readonly model: ModelRoute | null;
|
|
45
63
|
readonly spawnModel: ModelRoute | null;
|
|
64
|
+
readonly persona?: string | null;
|
|
46
65
|
}
|
|
47
66
|
export type LoopPacketNotification = ApplicationLoopPacket;
|
|
48
67
|
export interface LogEntryNotification {
|
|
@@ -50,17 +69,20 @@ export interface LogEntryNotification {
|
|
|
50
69
|
}
|
|
51
70
|
export type ProposalNotification = ProposalProjection;
|
|
52
71
|
export type LoopInteractionNotification = ClientInteractionProjection;
|
|
53
|
-
export
|
|
72
|
+
export type LoopGateSettledNotification = {
|
|
73
|
+
readonly kind: "proposal";
|
|
54
74
|
readonly sessionId: number;
|
|
55
75
|
readonly loopId: number;
|
|
56
|
-
readonly
|
|
57
|
-
readonly
|
|
58
|
-
readonly
|
|
59
|
-
|
|
60
|
-
readonly
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
63
|
-
|
|
76
|
+
readonly logEntryId: number;
|
|
77
|
+
readonly decision: ProposalDecision;
|
|
78
|
+
readonly outcome: string;
|
|
79
|
+
} | {
|
|
80
|
+
readonly kind: "interaction";
|
|
81
|
+
readonly sessionId: number;
|
|
82
|
+
readonly loopId: number;
|
|
83
|
+
readonly interactionId: number;
|
|
84
|
+
readonly action: "accept" | "decline" | "cancel";
|
|
85
|
+
};
|
|
64
86
|
export interface StreamEventNotification {
|
|
65
87
|
readonly entryId: number;
|
|
66
88
|
readonly sessionId: number;
|
|
@@ -123,27 +145,45 @@ export interface TerminatedNotification {
|
|
|
123
145
|
readonly meta: Record<string, unknown>;
|
|
124
146
|
};
|
|
125
147
|
}
|
|
148
|
+
export interface NotificationsResyncPayload {
|
|
149
|
+
readonly reason: "restarted" | "evicted" | "malformed";
|
|
150
|
+
readonly epoch: string;
|
|
151
|
+
readonly latestId: number;
|
|
152
|
+
}
|
|
153
|
+
export type NotificationReplayResult = {
|
|
154
|
+
readonly status: "ok";
|
|
155
|
+
readonly epoch: string;
|
|
156
|
+
readonly events: readonly DaemonNotification[];
|
|
157
|
+
} | {
|
|
158
|
+
readonly status: "resync";
|
|
159
|
+
readonly resync: NotificationsResyncPayload;
|
|
160
|
+
};
|
|
126
161
|
export interface DaemonNotificationPayloadMap {
|
|
127
162
|
readonly "workspace/created": WorkspaceCreatedNotification;
|
|
128
163
|
readonly "workspace/renamed": WorkspaceRenamedNotification;
|
|
129
164
|
readonly "workspace/archived": WorkspaceArchivedNotification;
|
|
130
|
-
readonly "
|
|
165
|
+
readonly "functionality/changed": FunctionalityChangedNotification;
|
|
131
166
|
readonly "session/created": SessionCreatedNotification;
|
|
132
167
|
readonly "session/archived": SessionArchivedNotification;
|
|
133
168
|
readonly "session/deleted": SessionDeletedNotification;
|
|
134
169
|
readonly "session/titled": SessionTitledNotification;
|
|
135
170
|
readonly "session/policy": SessionPolicyNotification;
|
|
136
|
-
readonly "loop/packet": LoopPacketNotification;
|
|
137
171
|
readonly "loop/proposal": ProposalNotification;
|
|
138
172
|
readonly "loop/interaction": LoopInteractionNotification;
|
|
173
|
+
readonly "loop/gate-settled": LoopGateSettledNotification;
|
|
139
174
|
readonly "loop/terminated": TerminatedNotification;
|
|
140
175
|
readonly "log/entry": LogEntryNotification;
|
|
141
|
-
readonly "operation/event": OperationEventNotification;
|
|
142
|
-
readonly "stream/event": StreamEventNotification;
|
|
143
176
|
readonly "stream/concluded": StreamConcludedNotification;
|
|
144
|
-
readonly "reasoning/event": ReasoningEventNotification;
|
|
145
177
|
readonly "notice/event": NoticeEventNotification;
|
|
146
178
|
}
|
|
179
|
+
export interface ApplicationRuntimeStreamPayloadMap {
|
|
180
|
+
readonly "workspace/preparation": WorkspacePreparationNotification;
|
|
181
|
+
readonly "loop/packet": LoopPacketNotification;
|
|
182
|
+
readonly "stream/event": StreamEventNotification;
|
|
183
|
+
readonly "reasoning/event": ReasoningEventNotification;
|
|
184
|
+
readonly "runtime/telemetry": NoticeEventNotification;
|
|
185
|
+
}
|
|
186
|
+
export type ApplicationRuntimeStreamHandler = <E extends ApplicationRuntimeStreamEvent = ApplicationRuntimeStreamEvent>(workspaceId: number, method: E, params: ApplicationRuntimeStreamPayloadMap[E]) => void;
|
|
147
187
|
export type DaemonNotification<E extends DaemonNotificationEvent = DaemonNotificationEvent> = {
|
|
148
188
|
[K in E]: {
|
|
149
189
|
readonly id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationNotifications.d.ts","sourceRoot":"","sources":["../../src/ApplicationNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,YAAY,
|
|
1
|
+
{"version":3,"file":"ApplicationNotifications.d.ts","sourceRoot":"","sources":["../../src/ApplicationNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,YAAY,EACZ,gBAAgB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EACR,kBAAkB,EAClB,2BAA2B,EAC3B,gCAAgC,EAChC,UAAU,EACV,UAAU,EACV,MAAM,EACN,eAAe,EACf,kBAAkB,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAA8B,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE3F;;;GAGG;AACH,eAAO,MAAM,0BAA0B,gUAiB5B,CAAC;AAEZ,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAIlF,eAAO,MAAM,yBAAyB,UAAW,OAAO,KAAG,KAAK,IAAI,uBACK,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,iCAAiC,2GAMnC,CAAC;AAEZ,MAAM,MAAM,6BAA6B,GAAG,CAAC,OAAO,iCAAiC,CAAC,CAAC,MA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AE,SAAS,uBAAuB,EAAE,CAAC;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC/B;AAgCD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,uBAAuB,MAC9D,MAAM,eACG,MAAM,GAAG,IAAI,SACnB,CAAC,QACF,4BAA4B,CAAC,CAAC,CAAC,cAC1B,MAAM,KAClB,kBAUF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,iBACpB,kBAAkB,WACvB,kBAAkB,KAC5B,OAqBF,CAAC;AAEF,MAAM,WAAW,+BAA+B,CAAC,CAAC,GAAG,OAAO;IACxD,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IAEnC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;CACxB"}
|
|
@@ -1,31 +1,64 @@
|
|
|
1
1
|
import { isRecord, isSafeInteger } from "./guards.js";
|
|
2
2
|
/**
|
|
3
|
-
* {§application-session-observation} The closed alphabet of daemon notification events
|
|
4
|
-
* across `ApplicationPort.subscribeToEvents` and `GET /notifications`.
|
|
3
|
+
* {§application-session-observation} The closed alphabet of discrete daemon notification events
|
|
4
|
+
* emitted across `ApplicationPort.subscribeToEvents` and `GET /notifications`.
|
|
5
5
|
*/
|
|
6
6
|
export const DAEMON_NOTIFICATION_EVENTS = Object.freeze([
|
|
7
7
|
"workspace/created",
|
|
8
8
|
"workspace/renamed",
|
|
9
9
|
"workspace/archived",
|
|
10
|
-
"
|
|
10
|
+
"functionality/changed",
|
|
11
11
|
"session/created",
|
|
12
12
|
"session/archived",
|
|
13
13
|
"session/deleted",
|
|
14
14
|
"session/titled",
|
|
15
15
|
"session/policy",
|
|
16
|
-
"loop/packet",
|
|
17
16
|
"loop/proposal",
|
|
18
17
|
"loop/interaction",
|
|
18
|
+
"loop/gate-settled",
|
|
19
19
|
"loop/terminated",
|
|
20
20
|
"log/entry",
|
|
21
|
-
"operation/event",
|
|
22
|
-
"stream/event",
|
|
23
21
|
"stream/concluded",
|
|
24
|
-
"reasoning/event",
|
|
25
22
|
"notice/event",
|
|
26
23
|
]);
|
|
27
24
|
const DAEMON_NOTIFICATION_EVENT_SET = new Set(DAEMON_NOTIFICATION_EVENTS);
|
|
28
25
|
export const isDaemonNotificationEvent = (value) => typeof value === "string" && DAEMON_NOTIFICATION_EVENT_SET.has(value);
|
|
26
|
+
/**
|
|
27
|
+
* {§application-session-observation} In-process sub-turn streaming and telemetry callbacks
|
|
28
|
+
* consumed by exterior protocol adapters (`plurnk-acp`, `plurnk-mcp`), never streamed on `GET /notifications`.
|
|
29
|
+
*/
|
|
30
|
+
export const APPLICATION_RUNTIME_STREAM_EVENTS = Object.freeze([
|
|
31
|
+
"workspace/preparation",
|
|
32
|
+
"loop/packet",
|
|
33
|
+
"stream/event",
|
|
34
|
+
"reasoning/event",
|
|
35
|
+
"runtime/telemetry",
|
|
36
|
+
]);
|
|
37
|
+
const APPLICATION_RUNTIME_STREAM_EVENT_SET = new Set(APPLICATION_RUNTIME_STREAM_EVENTS);
|
|
38
|
+
export const isApplicationRuntimeStreamEvent = (value) => typeof value === "string" && APPLICATION_RUNTIME_STREAM_EVENT_SET.has(value);
|
|
39
|
+
/**
|
|
40
|
+
* {§notifications} Classifies internal turn/lifecycle/derivation/progress telemetry notices that belong
|
|
41
|
+
* on `ApplicationPort.subscribeToRuntimeStream` (`runtime/telemetry`) rather than public `notice/event`.
|
|
42
|
+
*/
|
|
43
|
+
export const isRuntimeTelemetryNotice = (notice) => {
|
|
44
|
+
if (notice.source === "engine:lifecycle" ||
|
|
45
|
+
notice.source === "engine:derivation" ||
|
|
46
|
+
notice.source === "engine:emission") {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
if (notice.source === "engine:turn" &&
|
|
50
|
+
(notice.kind === "turn_awaiting_model" ||
|
|
51
|
+
notice.kind === "turn_generated" ||
|
|
52
|
+
notice.kind === "results_pending")) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
if (notice.source.startsWith("exec:") && typeof notice.percent === "number") {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
return typeof notice.message !== "string" || notice.message.trim().length === 0;
|
|
59
|
+
};
|
|
60
|
+
const _envelopeWitness = true;
|
|
61
|
+
void _envelopeWitness;
|
|
29
62
|
const extractSessionId = (event, data) => {
|
|
30
63
|
if (!isRecord(data))
|
|
31
64
|
return null;
|