@canonmsg/agent-sdk 12.4.1 → 12.6.1

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.
Files changed (40) hide show
  1. package/README.md +37 -6
  2. package/dist/chunks/{chunk-6PKXASSK.js → chunk-5J4YPLNW.js} +394 -1687
  3. package/dist/chunks/{chunk-NXL4C2R6.js → chunk-DAJ7L7TN.js} +954 -429
  4. package/dist/chunks/chunk-FVYKLH6I.js +1475 -0
  5. package/dist/chunks/chunk-HH7KR22P.js +406 -0
  6. package/dist/chunks/chunk-QK37HAHC.js +118 -0
  7. package/dist/chunks/{chunk-GWQF4WFT.js → chunk-S7BV74DN.js} +734 -812
  8. package/dist/chunks/{mls-crypto-LGPCXM3K.js → mls-crypto-4DZT2UFH.js} +2 -1
  9. package/dist/cli.js +70 -32
  10. package/dist/drivers/acp.d.ts +56 -0
  11. package/dist/drivers/codex.d.ts +1 -2
  12. package/dist/drivers/connector.d.ts +5 -4
  13. package/dist/drivers/subprocess.d.ts +35 -0
  14. package/dist/index.d.ts +3 -1
  15. package/dist/index.js +12 -3
  16. package/dist/internal/backend-contracts/connectorRelay.d.ts +34 -0
  17. package/dist/internal/backend-contracts/endpoint.d.ts +1 -1
  18. package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +2 -2
  19. package/dist/internal/backend-contracts/index.d.ts +1 -0
  20. package/dist/internal/backend-contracts/loggedOutSessions.d.ts +7 -0
  21. package/dist/internal/backend-contracts/mlsDevCredential.d.ts +3 -0
  22. package/dist/internal/endpoint/engine.d.ts +8 -1
  23. package/dist/internal/endpoint/mls-dev-client.d.ts +11 -0
  24. package/dist/internal/endpoint/mls-dev-text.d.ts +3 -0
  25. package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +5 -0
  26. package/dist/internal/endpoint/node.d.ts +1 -0
  27. package/dist/media.js +4 -2
  28. package/dist/mls/darwin-arm64/canon-mls-custody +0 -0
  29. package/dist/mls/linux-arm64/canon-mls-custody +0 -0
  30. package/dist/mls/linux-x64/canon-mls-custody +0 -0
  31. package/dist/mls/wasm/canon_mls_wasm.js +363 -0
  32. package/dist/mls/wasm/canon_mls_wasm_bg.wasm +0 -0
  33. package/dist/mls-wasm-host.js +258 -0
  34. package/dist/runner/mls-bundled.d.ts +15 -2
  35. package/dist/runner/mls-managed.d.ts +10 -2
  36. package/dist/runner/mls.d.ts +7 -1
  37. package/dist/runner/relay.d.ts +3 -3
  38. package/dist/runner/runner.d.ts +18 -7
  39. package/dist/runner/types.d.ts +12 -4
  40. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
- import type { MlsDevDeviceContext, MlsEnvironmentId } from '../internal/backend-contracts/index.js';
1
+ import { type MlsDevDeviceContext, type MlsEnvironmentId } from '../internal/backend-contracts/index.js';
2
+ import { type BundledMlsWasmCore } from './mls-bundled.js';
2
3
  import type { RunnerMlsOptions } from './mls.js';
3
4
  export interface ManagedMlsDeviceOptions {
4
5
  /** The runner's home (CANON_HOME, or a relay installation's home). */
@@ -9,6 +10,8 @@ export interface ManagedMlsDeviceOptions {
9
10
  path: string;
10
11
  sha256: string;
11
12
  };
13
+ /** The WASM core rather than a helper, as on a host with none. */
14
+ wasm?: BundledMlsWasmCore;
12
15
  /** Other public pins than this package's for the environment. */
13
16
  pins?: {
14
17
  issuerKeys: ReadonlyArray<{
@@ -24,8 +27,13 @@ export interface ManagedMlsDeviceOptions {
24
27
  }
25
28
  export type ManagedMlsDevice = RunnerMlsOptions & {
26
29
  provision(context: MlsDevDeviceContext): Promise<void>;
27
- /** Whether this context's vault exists: its device was provisioned here. */
30
+ /** Whether this context's device was provisioned here. Throws, saying why, if it was made in the way this host cannot open. */
28
31
  provisioned(context: MlsDevDeviceContext): boolean;
29
32
  close(): Promise<void>;
30
33
  };
34
+ /**
35
+ * A runner's device where it is given none (`createRunner` and the CLI alike): managed custody as `custodyFor` chooses, or
36
+ * undefined where this package ships neither helper nor core, or the environment has no MLS.
37
+ */
38
+ export declare function defaultMlsDevice(home: string, environmentId: string): ManagedMlsDevice | undefined;
31
39
  export declare function managedMlsDevice(options: ManagedMlsDeviceOptions): ManagedMlsDevice;
@@ -84,11 +84,17 @@ export declare function mlsDevRoomPackageId(identity: {
84
84
  installationId: string;
85
85
  ownershipVersion?: number;
86
86
  }, room: string): string;
87
+ /**
88
+ * Managed custody opens only the vaults it made in its home. A device the engine store holds with no vault there (set up
89
+ * with an operator's configuration, or its vault lost) is refused once, here, rather than failing in every room.
90
+ */
91
+ export declare function assertMlsVaultInHome(endpoint: CanonEndpoint, provisioned: (context: MlsDevDeviceContext) => boolean): Promise<void>;
87
92
  /**
88
93
  * One operator step for the agent's device (`canon-agent mls`), on the same engine store the runner uses. It never
89
94
  * starts a model, and prints only public device state: no credentials, proofs, envelopes or history. `setup` does what
90
95
  * is left of provision then enroll, so it also finishes a setup that stopped part way; it never replaces a vault, and
91
- * with `provisioned` (managed custody) it provisions only where this installation has none.
96
+ * with `provisioned` (managed custody) it provisions only where this installation has none, and refuses a device whose
97
+ * vault is elsewhere.
92
98
  */
93
99
  export declare function runMlsDevSetup(endpoint: CanonEndpoint, action: MlsSetupAction, room?: string, provision?: (context: MlsDevDeviceContext) => Promise<void>, provisioned?: (context: MlsDevDeviceContext) => boolean): Promise<{
94
100
  conversationId?: string | undefined;
@@ -1,9 +1,9 @@
1
1
  import { type ConnectorRelayCredentialDelivery } from '../internal/backend-contracts/index.js';
2
2
  import type { ConnectorInbox } from '../drivers/connector.js';
3
3
  import type { Runner } from './runner.js';
4
- /** What the channel serves: the relay's runner (history and sends) and its connector driver's inbox (pickup). */
4
+ /** What the channel serves: the relay's runner (history, sends and starts) and its connector driver's inbox (pickup). */
5
5
  export interface RelayTarget {
6
- runner: Pick<Runner, 'relayRead' | 'relaySend'>;
6
+ runner: Pick<Runner, 'relayRead' | 'relaySend' | 'relayStart'>;
7
7
  inbox: ConnectorInbox;
8
8
  }
9
9
  /** Canon's credential for this relay, as delivered: the connection it serves is the delivering request's. */
@@ -12,7 +12,7 @@ export type RelayCredentialDelivery = ConnectorRelayCredentialDelivery & {
12
12
  };
13
13
  export interface RelayChannelOptions {
14
14
  /** The runner and inbox to serve from the start; `serve` sets or replaces them. Until then only `credential` is answered. */
15
- runner?: Pick<Runner, 'relayRead' | 'relaySend'>;
15
+ runner?: Pick<Runner, 'relayRead' | 'relaySend' | 'relayStart'>;
16
16
  inbox?: ConnectorInbox;
17
17
  /** The relayed agent: requests naming another agent are refused. */
18
18
  agentId: string;
@@ -1,5 +1,5 @@
1
1
  import type { AgentWakeConfiguration } from '../internal/backend-contracts/index.js';
2
- import { type ConnectorRelayPage, type ConnectorRelaySent } from '../internal/backend-contracts/index.js';
2
+ import { type ConnectorRelayPage, type ConnectorRelaySent, type ConnectorRelayStarted, type DirectConversationSelection } from '../internal/backend-contracts/index.js';
3
3
  import { type CanonEndpoint, type CanonRuntimeDescriptor, type CommunicateInput, type CommunicateResult } from '../internal/core/index.js';
4
4
  import { type RunnerMlsOptions } from './mls.js';
5
5
  import { type RuntimeDriver } from './types.js';
@@ -26,16 +26,18 @@ export interface RunnerOptions {
26
26
  baseUrl?: string;
27
27
  streamUrl?: string;
28
28
  /**
29
- * The agent's MLS device (Dev only, spec §6): issuer pins and custody, from `loadMlsDevConfiguration`. With it the
30
- * runner takes part in encrypted rooms; without it each encrypted room is refused, once, in the log. An injected
31
- * `endpoint` that already has an MLS device counts as configured. `close` runs last on shutdown.
29
+ * The agent's MLS device (spec §6): issuer pins and custody, from `loadMlsDevConfiguration` or `managedMlsDevice`. Left
30
+ * out, it is managed custody in `home` where this package ships a custody helper for the host, as the CLI's; `false` is
31
+ * none. With a device the runner takes part in encrypted rooms; without one each encrypted room is refused, once, in the
32
+ * log. An injected `endpoint` brings its own device, if any. `close` runs last on shutdown.
32
33
  */
33
- mls?: RunnerMlsOptions;
34
+ mls?: RunnerMlsOptions | false;
34
35
  /**
35
36
  * Relay mode, the class-C relay (spec §11.4): only encrypted rooms are served, which is what lets a `remote` driver
36
37
  * (the connector) into them. Plaintext input is cancelled with no turn (the connector's own installation serves it),
37
- * control hints are read only for encrypted rooms, no runtime descriptor is published, and `relayRead` and `relaySend`
38
- * serve the relay channel. It needs the agent's MLS device.
38
+ * control hints are read only for encrypted rooms, and `relayRead` and `relaySend` serve the relay channel. It publishes
39
+ * the runtime descriptor and heartbeat, so the apps show a relayed turn working and offer Stop. It needs the agent's MLS
40
+ * device.
39
41
  */
40
42
  relay?: boolean;
41
43
  /** The engine's installation: the relay's reserved one, from its configuration. A store opened under another refuses to start. */
@@ -95,6 +97,15 @@ export interface Runner {
95
97
  relaySend(conversationId: string, messageId: string, text: string, options?: {
96
98
  deadline?: number;
97
99
  }): Promise<ConnectorRelaySent>;
100
+ /**
101
+ * Relay mode (§11.5): a conversation started with a person or agent, its opening line withheld from Canon and kept
102
+ * here first; this device founds (or finds) the encrypted room and sends the line. The same `messageId` is the same
103
+ * start. It answers by `deadline`: `starting` means unresolved, even if recording has not finished; retry the same
104
+ * identity until another answer arrives. Only a persisted start resumes automatically after a restart.
105
+ */
106
+ relayStart(targetUserId: string, messageId: string, text: string, selection?: DirectConversationSelection, options?: {
107
+ deadline?: number;
108
+ }): Promise<ConnectorRelayStarted>;
98
109
  }
99
110
  /** RUN-27: generated once from the driver's declarations; no static capability table. */
100
111
  export declare function runtimeDescriptor(driver: RuntimeDriver): CanonRuntimeDescriptor;
@@ -5,7 +5,7 @@ import type { MediaAttachment } from '../internal/core/index.js';
5
5
  * the claude and codex drivers pass the conformance suite.
6
6
  */
7
7
  export interface RuntimeDriver {
8
- readonly name: 'code' | 'claude' | 'codex' | 'connector';
8
+ readonly name: 'code' | 'claude' | 'codex' | 'acp' | 'connector';
9
9
  /** Input to the generated runtime descriptor; never a static table. */
10
10
  readonly capabilities: DriverCapabilities;
11
11
  runTurn(turn: DriverTurn): Promise<DriverResult>;
@@ -36,8 +36,9 @@ export interface DriverTurn {
36
36
  tools: TurnTools;
37
37
  /**
38
38
  * For a `remote` runtime, before its input first leaves this host (the connector's claim): the runner reads the
39
- * agent's membership, and an encrypted room's audience, from Canon now and counts the pickup as progress (RUN-12).
40
- * It rejects, and ends the turn, when the agent may no longer act on this input; a transient failure only rejects.
39
+ * agent's membership, and an encrypted room's audience, from Canon now, submits the input on the first confirmed
40
+ * pickup (until then it is only offered, with no deadline) and counts each pickup as progress (RUN-12). It rejects,
41
+ * and ends the turn, when the agent may no longer act on this input; a transient failure only rejects.
41
42
  */
42
43
  confirmPickup(): Promise<void>;
43
44
  }
@@ -65,9 +66,16 @@ export interface DriverCapabilities {
65
66
  /**
66
67
  * The runtime runs off the runner's host (the class-C connector, spec §11.3): it gets no local files (inbound
67
68
  * attachments are named in the prompt, never materialized), and since its plaintext leaves this host, the runner
68
- * takes it into encrypted rooms only in relay mode, whose installation discloses that.
69
+ * takes it into encrypted rooms only in relay mode, whose installation discloses that. Its input is offered first and
70
+ * submitted only when the runtime picks it up (`confirmPickup`); newer messages in the room join an input not yet
71
+ * picked up.
69
72
  */
70
73
  remote?: boolean;
74
+ /**
75
+ * The runtime takes only its owner's messages, so the recent history a `none` session carries holds only those and the
76
+ * agent's own. Otherwise a message refused at the door would reach the runtime in the owner's next turn, with the owner's tools.
77
+ */
78
+ ownerHistoryOnly?: boolean;
71
79
  /** Across rooms; runner default 8. */
72
80
  maxConcurrentTurns?: number;
73
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/agent-sdk",
3
- "version": "12.4.1",
3
+ "version": "12.6.1",
4
4
  "description": "Canon Agent SDK — build AI agents that participate in Canon conversations",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",