@canonmsg/codex-plugin 0.18.11 → 0.19.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/README.md +2 -2
- package/dist/app-server-adapter.d.ts +5 -0
- package/dist/app-server-adapter.js +36 -5
- package/dist/app-server-approval.d.ts +1 -1
- package/dist/app-server-approval.js +1 -1
- package/dist/bridge-bin.d.ts +14 -0
- package/dist/bridge-bin.js +27 -0
- package/dist/cli-entry.d.ts +2 -2
- package/dist/cli-entry.js +1 -1
- package/dist/codex-app-tools.d.ts +42 -0
- package/dist/codex-app-tools.js +519 -0
- package/dist/control-channel.d.ts +26 -46
- package/dist/control-channel.js +37 -50
- package/dist/host.d.ts +1 -1
- package/dist/host.js +840 -929
- package/dist/register.js +73 -25
- package/dist/session-store.d.ts +1 -1
- package/dist/session-store.js +2 -2
- package/dist/turn-activity.d.ts +7 -11
- package/dist/turn-activity.js +7 -41
- package/package.json +10 -7
- package/dist/host-lifecycle.d.ts +0 -4
- package/dist/host-lifecycle.js +0 -3
- package/dist/inbound-policy.d.ts +0 -22
- package/dist/inbound-policy.js +0 -46
- package/dist/startup-recovery.d.ts +0 -46
- package/dist/startup-recovery.js +0 -59
package/dist/control-channel.js
CHANGED
|
@@ -1,56 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Codex host
|
|
2
|
+
* Codex host control-channel wiring (bridge notifications).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Phase 6: the host-side RTDB `/control` poller is DELETED — the Bridge is
|
|
5
|
+
* the single authoritative consumer for this identity (one adaptive poller
|
|
6
|
+
* per daemon; cadence, jitter, baselines and consume semantics live there)
|
|
7
|
+
* and pushes `onSessionControl` / `onControlSignal` / `onControlPrimitive`
|
|
8
|
+
* notifications instead. This module keeps the codex-shaped handler wiring:
|
|
9
|
+
* session + signal ride the shared agent-host router; the primitive channel
|
|
10
|
+
* (context.compact) subscribes alongside them.
|
|
7
11
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
* the activity probe sampled BEFORE the cycle runs.
|
|
13
|
-
* - Session controls are always consumed once newer (default consume), even
|
|
14
|
-
* when no live session applied them; signals are NOT consumed when the
|
|
15
|
-
* handler throws (consumeOnError stays false).
|
|
16
|
-
* - Dedupe is primed eagerly via `poller.baseline([conversationId])` at
|
|
17
|
-
* session creation — the second legacy poll site.
|
|
12
|
+
* Consume semantics note (deliberate Phase-6 change, plan §2): the node is
|
|
13
|
+
* consumed bridge-side BEFORE dispatch, so handler return values are
|
|
14
|
+
* advisory-only and a throwing handler is logged, never retried — the legacy
|
|
15
|
+
* leave-in-place-on-error behavior is gone with the host poller.
|
|
18
16
|
*/
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
rtdb: input.rtdb,
|
|
26
|
-
agentId: input.agentId,
|
|
27
|
-
conversationIds: input.conversationIds,
|
|
28
|
-
cadence: {
|
|
29
|
-
kind: 'adaptive',
|
|
30
|
-
activeMs: CONTROL_POLL_MS,
|
|
31
|
-
idleMs: IDLE_CONTROL_POLL_MS,
|
|
32
|
-
jitterMs: CONTROL_POLL_JITTER_MS,
|
|
33
|
-
hasActiveWork: input.hasActiveWork,
|
|
34
|
-
activitySample: 'cycle-start',
|
|
35
|
-
},
|
|
36
|
-
pollOnStart: true,
|
|
37
|
-
conversationConcurrency: 'sequential',
|
|
38
|
-
handlers: {
|
|
39
|
-
session: {
|
|
40
|
-
handle: input.onSessionControl,
|
|
41
|
-
},
|
|
42
|
-
signal: {
|
|
43
|
-
handle: input.onSignal,
|
|
44
|
-
},
|
|
45
|
-
...(input.onPrimitive
|
|
46
|
-
? {
|
|
47
|
-
primitive: {
|
|
48
|
-
handle: input.onPrimitive,
|
|
49
|
-
},
|
|
50
|
-
}
|
|
51
|
-
: {}),
|
|
52
|
-
},
|
|
53
|
-
...(input.onError ? { onError: input.onError } : {}),
|
|
54
|
-
...(input.random ? { random: input.random } : {}),
|
|
17
|
+
import { attachHostControlNotifications, } from '@canonmsg/agent-host';
|
|
18
|
+
/** Wire the codex control handlers to the bridge notifications; returns detach. */
|
|
19
|
+
export function attachCodexControlNotifications(input) {
|
|
20
|
+
const report = input.onError ?? ((error, kind, conversationId) => {
|
|
21
|
+
const convo = conversationId ? ` [${conversationId.slice(0, 8)}]` : '';
|
|
22
|
+
console.error(`[canon-codex]${convo} Control ${kind} handler error:`, error);
|
|
55
23
|
});
|
|
24
|
+
const detachShared = attachHostControlNotifications(input.source, { logPrefix: '[canon-codex]' }, {
|
|
25
|
+
onSessionControl: input.onSessionControl,
|
|
26
|
+
onControlSignal: input.onSignal,
|
|
27
|
+
onError: (error, kind, conversationId) => report(error, kind, conversationId),
|
|
28
|
+
});
|
|
29
|
+
let detachPrimitive = null;
|
|
30
|
+
if (input.onPrimitive) {
|
|
31
|
+
const onPrimitive = input.onPrimitive;
|
|
32
|
+
detachPrimitive = input.source.onNotification('onControlPrimitive', (params) => {
|
|
33
|
+
const event = params;
|
|
34
|
+
void Promise.resolve(onPrimitive(event)).catch((error) => {
|
|
35
|
+
report(error, 'primitive', event?.conversationId ?? null);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return () => {
|
|
40
|
+
detachShared();
|
|
41
|
+
detachPrimitive?.();
|
|
42
|
+
};
|
|
56
43
|
}
|
package/dist/host.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { type CanonRuntimeCommandDescriptor, type CanonRuntimeDescriptor, type CanonRuntimePresentationPolicy, type ExecutionEnvironmentMode, type WorkspaceOption, type CanonWorkspaceRootMetadata } from '@canonmsg/core';
|
|
2
|
+
import { type CanonRuntimeCommandDescriptor, type CanonRuntimeDescriptor, type CanonRuntimePresentationPolicy, type ExecutionEnvironmentMode, type WorkspaceOption, type CanonWorkspaceRootMetadata } from '@canonmsg/core/contract';
|
|
3
3
|
import { type CodexSkillMetadata } from './app-server-adapter.js';
|
|
4
4
|
interface HostSessionState {
|
|
5
5
|
lastError?: string;
|