@scotthuang/agent-knock-knock 0.13.17 → 0.14.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/CHANGELOG.md +38 -0
- package/CONTRIBUTING.md +212 -0
- package/README.md +105 -166
- package/connectors/deepseek-harness/LICENSE +21 -0
- package/connectors/deepseek-harness/README.md +406 -0
- package/connectors/pi/LICENSE +21 -0
- package/connectors/pi/README.md +446 -0
- package/dist/src/backend-recovery-semantic.d.ts +16 -0
- package/dist/src/backend-recovery-semantic.js +113 -0
- package/dist/src/backend-recovery-semantic.js.map +1 -0
- package/dist/src/backend-task-recovery.d.ts +103 -0
- package/dist/src/backend-task-recovery.js +142 -0
- package/dist/src/backend-task-recovery.js.map +1 -0
- package/dist/src/callback-transport.d.ts +8 -0
- package/dist/src/callback-transport.js +14 -0
- package/dist/src/callback-transport.js.map +1 -1
- package/dist/src/cli-core.js +18 -8
- package/dist/src/cli-core.js.map +1 -1
- package/dist/src/cli-runtime-context.d.ts +5 -0
- package/dist/src/cli-runtime-context.js.map +1 -1
- package/dist/src/codex-async-question-adapter.js +14 -4
- package/dist/src/codex-async-question-adapter.js.map +1 -1
- package/dist/src/codex-lifecycle-compatibility.d.ts +1 -1
- package/dist/src/codex-lifecycle-compatibility.js +9 -3
- package/dist/src/codex-lifecycle-compatibility.js.map +1 -1
- package/dist/src/codex-native-cli-adapter.d.ts +6 -0
- package/dist/src/codex-native-cli-adapter.js +273 -0
- package/dist/src/codex-native-cli-adapter.js.map +1 -0
- package/dist/src/codex-native-client-interactions.d.ts +6 -0
- package/dist/src/codex-native-client-interactions.js +124 -0
- package/dist/src/codex-native-client-interactions.js.map +1 -0
- package/dist/src/codex-native-client-rpc.d.ts +21 -0
- package/dist/src/codex-native-client-rpc.js +137 -0
- package/dist/src/codex-native-client-rpc.js.map +1 -0
- package/dist/src/codex-native-client.d.ts +42 -0
- package/dist/src/codex-native-client.js +326 -0
- package/dist/src/codex-native-client.js.map +1 -0
- package/dist/src/codex-native-identity.d.ts +6 -0
- package/dist/src/codex-native-identity.js +42 -0
- package/dist/src/codex-native-identity.js.map +1 -0
- package/dist/src/codex-native-monitor.d.ts +4 -0
- package/dist/src/codex-native-monitor.js +92 -0
- package/dist/src/codex-native-monitor.js.map +1 -0
- package/dist/src/codex-native-outbox.d.ts +16 -0
- package/dist/src/codex-native-outbox.js +120 -0
- package/dist/src/codex-native-outbox.js.map +1 -0
- package/dist/src/codex-native-public-projection.d.ts +545 -0
- package/dist/src/codex-native-public-projection.js +182 -0
- package/dist/src/codex-native-public-projection.js.map +1 -0
- package/dist/src/codex-native-record-store.d.ts +27 -0
- package/dist/src/codex-native-record-store.js +111 -0
- package/dist/src/codex-native-record-store.js.map +1 -0
- package/dist/src/codex-native-response-service.d.ts +69 -0
- package/dist/src/codex-native-response-service.js +244 -0
- package/dist/src/codex-native-response-service.js.map +1 -0
- package/dist/src/codex-native-runtime.d.ts +46 -0
- package/dist/src/codex-native-runtime.js +112 -0
- package/dist/src/codex-native-runtime.js.map +1 -0
- package/dist/src/codex-native-semantic.d.ts +17 -0
- package/dist/src/codex-native-semantic.js +175 -0
- package/dist/src/codex-native-semantic.js.map +1 -0
- package/dist/src/codex-native-snapshot.d.ts +19 -0
- package/dist/src/codex-native-snapshot.js +160 -0
- package/dist/src/codex-native-snapshot.js.map +1 -0
- package/dist/src/codex-native-state-store.d.ts +61 -0
- package/dist/src/codex-native-state-store.js +132 -0
- package/dist/src/codex-native-state-store.js.map +1 -0
- package/dist/src/codex-native-task-service.d.ts +71 -0
- package/dist/src/codex-native-task-service.js +502 -0
- package/dist/src/codex-native-task-service.js.map +1 -0
- package/dist/src/codex-native-types.d.ts +92 -0
- package/dist/src/codex-native-types.js +15 -0
- package/dist/src/codex-native-types.js.map +1 -0
- package/dist/src/codex-permission-surface.d.ts +1 -1
- package/dist/src/codex-permission-surface.js +1 -1
- package/dist/src/codex-permission-surface.js.map +1 -1
- package/dist/src/codex-terminal-agent-adapter.js +3 -1
- package/dist/src/codex-terminal-agent-adapter.js.map +1 -1
- package/dist/src/conversation-list.d.ts +12 -0
- package/dist/src/conversation-list.js +30 -0
- package/dist/src/conversation-list.js.map +1 -0
- package/dist/src/conversation-route-dispatch.d.ts +13 -0
- package/dist/src/conversation-route-dispatch.js +66 -0
- package/dist/src/conversation-route-dispatch.js.map +1 -0
- package/dist/src/conversation-route-legacy.d.ts +18 -0
- package/dist/src/conversation-route-legacy.js +54 -0
- package/dist/src/conversation-route-legacy.js.map +1 -0
- package/dist/src/conversation-route-store.d.ts +51 -0
- package/dist/src/conversation-route-store.js +126 -0
- package/dist/src/conversation-route-store.js.map +1 -0
- package/dist/src/conversation-routing-cli-adapter.d.ts +12 -0
- package/dist/src/conversation-routing-cli-adapter.js +211 -0
- package/dist/src/conversation-routing-cli-adapter.js.map +1 -0
- package/dist/src/conversation-routing-commands.d.ts +11 -0
- package/dist/src/conversation-routing-commands.js +85 -0
- package/dist/src/conversation-routing-commands.js.map +1 -0
- package/dist/src/conversation-routing-home.d.ts +26 -0
- package/dist/src/conversation-routing-home.js +105 -0
- package/dist/src/conversation-routing-home.js.map +1 -0
- package/dist/src/conversation-routing-identity.d.ts +40 -0
- package/dist/src/conversation-routing-identity.js +174 -0
- package/dist/src/conversation-routing-identity.js.map +1 -0
- package/dist/src/conversation-runtime-route-store.d.ts +11 -0
- package/dist/src/conversation-runtime-route-store.js +118 -0
- package/dist/src/conversation-runtime-route-store.js.map +1 -0
- package/dist/src/desktop-async-interactions.d.ts +15 -0
- package/dist/src/desktop-async-interactions.js +88 -0
- package/dist/src/desktop-async-interactions.js.map +1 -0
- package/dist/src/desktop-async-state.d.ts +5 -0
- package/dist/src/desktop-async-state.js +53 -0
- package/dist/src/desktop-async-state.js.map +1 -0
- package/dist/src/desktop-cli-adapter.d.ts +7 -0
- package/dist/src/desktop-cli-adapter.js +322 -0
- package/dist/src/desktop-cli-adapter.js.map +1 -0
- package/dist/src/desktop-cli-controls.d.ts +9 -0
- package/dist/src/desktop-cli-controls.js +45 -0
- package/dist/src/desktop-cli-controls.js.map +1 -0
- package/dist/src/desktop-command-presentation.d.ts +2 -0
- package/dist/src/desktop-command-presentation.js +31 -0
- package/dist/src/desktop-command-presentation.js.map +1 -0
- package/dist/src/desktop-control-semantic.d.ts +8 -0
- package/dist/src/desktop-control-semantic.js +68 -0
- package/dist/src/desktop-control-semantic.js.map +1 -0
- package/dist/src/desktop-identity.d.ts +5 -0
- package/dist/src/desktop-identity.js +40 -0
- package/dist/src/desktop-identity.js.map +1 -0
- package/dist/src/desktop-interaction-projection.d.ts +57 -0
- package/dist/src/desktop-interaction-projection.js +196 -0
- package/dist/src/desktop-interaction-projection.js.map +1 -0
- package/dist/src/desktop-interaction-state.d.ts +3 -0
- package/dist/src/desktop-interaction-state.js +48 -0
- package/dist/src/desktop-interaction-state.js.map +1 -0
- package/dist/src/desktop-ipc-async-answer.d.ts +9 -0
- package/dist/src/desktop-ipc-async-answer.js +71 -0
- package/dist/src/desktop-ipc-async-answer.js.map +1 -0
- package/dist/src/desktop-ipc-client.d.ts +47 -0
- package/dist/src/desktop-ipc-client.js +400 -0
- package/dist/src/desktop-ipc-client.js.map +1 -0
- package/dist/src/desktop-ipc-native-operations.d.ts +11 -0
- package/dist/src/desktop-ipc-native-operations.js +126 -0
- package/dist/src/desktop-ipc-native-operations.js.map +1 -0
- package/dist/src/desktop-ipc-transport.d.ts +13 -0
- package/dist/src/desktop-ipc-transport.js +123 -0
- package/dist/src/desktop-ipc-transport.js.map +1 -0
- package/dist/src/desktop-list.d.ts +25 -0
- package/dist/src/desktop-list.js +55 -0
- package/dist/src/desktop-list.js.map +1 -0
- package/dist/src/desktop-metadata-reader.d.ts +30 -0
- package/dist/src/desktop-metadata-reader.js +182 -0
- package/dist/src/desktop-metadata-reader.js.map +1 -0
- package/dist/src/desktop-monitor.d.ts +4 -0
- package/dist/src/desktop-monitor.js +101 -0
- package/dist/src/desktop-monitor.js.map +1 -0
- package/dist/src/desktop-public-projection.d.ts +6 -0
- package/dist/src/desktop-public-projection.js +134 -0
- package/dist/src/desktop-public-projection.js.map +1 -0
- package/dist/src/desktop-request-interactions.d.ts +14 -0
- package/dist/src/desktop-request-interactions.js +144 -0
- package/dist/src/desktop-request-interactions.js.map +1 -0
- package/dist/src/desktop-response-dispatch.d.ts +14 -0
- package/dist/src/desktop-response-dispatch.js +19 -0
- package/dist/src/desktop-response-dispatch.js.map +1 -0
- package/dist/src/desktop-response-evidence.d.ts +4 -0
- package/dist/src/desktop-response-evidence.js +19 -0
- package/dist/src/desktop-response-evidence.js.map +1 -0
- package/dist/src/desktop-response-service.d.ts +11 -0
- package/dist/src/desktop-response-service.js +188 -0
- package/dist/src/desktop-response-service.js.map +1 -0
- package/dist/src/desktop-response-store.d.ts +35 -0
- package/dist/src/desktop-response-store.js +58 -0
- package/dist/src/desktop-response-store.js.map +1 -0
- package/dist/src/desktop-response-types.d.ts +20 -0
- package/dist/src/desktop-response-types.js +2 -0
- package/dist/src/desktop-response-types.js.map +1 -0
- package/dist/src/desktop-response-value.d.ts +6 -0
- package/dist/src/desktop-response-value.js +31 -0
- package/dist/src/desktop-response-value.js.map +1 -0
- package/dist/src/desktop-runtime.d.ts +153 -0
- package/dist/src/desktop-runtime.js +88 -0
- package/dist/src/desktop-runtime.js.map +1 -0
- package/dist/src/desktop-semantic.d.ts +21 -0
- package/dist/src/desktop-semantic.js +140 -0
- package/dist/src/desktop-semantic.js.map +1 -0
- package/dist/src/desktop-session-catalog.d.ts +68 -0
- package/dist/src/desktop-session-catalog.js +225 -0
- package/dist/src/desktop-session-catalog.js.map +1 -0
- package/dist/src/desktop-session-controls.d.ts +145 -0
- package/dist/src/desktop-session-controls.js +176 -0
- package/dist/src/desktop-session-controls.js.map +1 -0
- package/dist/src/desktop-sidebar-metadata.d.ts +27 -0
- package/dist/src/desktop-sidebar-metadata.js +83 -0
- package/dist/src/desktop-sidebar-metadata.js.map +1 -0
- package/dist/src/desktop-sidebar-projects.d.ts +10 -0
- package/dist/src/desktop-sidebar-projects.js +31 -0
- package/dist/src/desktop-sidebar-projects.js.map +1 -0
- package/dist/src/desktop-sidebar-selection.d.ts +28 -0
- package/dist/src/desktop-sidebar-selection.js +85 -0
- package/dist/src/desktop-sidebar-selection.js.map +1 -0
- package/dist/src/desktop-snapshot-details.d.ts +4 -0
- package/dist/src/desktop-snapshot-details.js +116 -0
- package/dist/src/desktop-snapshot-details.js.map +1 -0
- package/dist/src/desktop-snapshot.d.ts +11 -0
- package/dist/src/desktop-snapshot.js +276 -0
- package/dist/src/desktop-snapshot.js.map +1 -0
- package/dist/src/desktop-state-store.d.ts +72 -0
- package/dist/src/desktop-state-store.js +269 -0
- package/dist/src/desktop-state-store.js.map +1 -0
- package/dist/src/desktop-task-interactions.d.ts +10 -0
- package/dist/src/desktop-task-interactions.js +93 -0
- package/dist/src/desktop-task-interactions.js.map +1 -0
- package/dist/src/desktop-task-recovery.d.ts +38 -0
- package/dist/src/desktop-task-recovery.js +171 -0
- package/dist/src/desktop-task-recovery.js.map +1 -0
- package/dist/src/desktop-task-service.d.ts +54 -0
- package/dist/src/desktop-task-service.js +441 -0
- package/dist/src/desktop-task-service.js.map +1 -0
- package/dist/src/desktop-types.d.ts +281 -0
- package/dist/src/desktop-types.js +13 -0
- package/dist/src/desktop-types.js.map +1 -0
- package/dist/src/host-monitor-reconciliation.js +36 -4
- package/dist/src/host-monitor-reconciliation.js.map +1 -1
- package/dist/src/host-profile-runtime.js +7 -3
- package/dist/src/host-profile-runtime.js.map +1 -1
- package/dist/src/local-codex-cli-adapter.d.ts +7 -0
- package/dist/src/local-codex-cli-adapter.js +13 -0
- package/dist/src/local-codex-cli-adapter.js.map +1 -0
- package/dist/src/openclaw-callback-transport.js +2 -1
- package/dist/src/openclaw-callback-transport.js.map +1 -1
- package/dist/src/semantic-conversation-target.d.ts +4 -0
- package/dist/src/semantic-conversation-target.js +20 -0
- package/dist/src/semantic-conversation-target.js.map +1 -0
- package/dist/src/semantic-permission-control.js +47 -9
- package/dist/src/semantic-permission-control.js.map +1 -1
- package/dist/src/semantic-private-authority-offers.d.ts +1 -1
- package/dist/src/semantic-private-authority-offers.js +3 -1
- package/dist/src/semantic-private-authority-offers.js.map +1 -1
- package/dist/src/semantic-tool-command-helpers.d.ts +6 -0
- package/dist/src/semantic-tool-command-helpers.js +199 -78
- package/dist/src/semantic-tool-command-helpers.js.map +1 -1
- package/dist/src/semantic-tool-descriptions.d.ts +2 -1
- package/dist/src/semantic-tool-descriptions.js +81 -35
- package/dist/src/semantic-tool-descriptions.js.map +1 -1
- package/dist/src/semantic-tool-list-projection.js +66 -2
- package/dist/src/semantic-tool-list-projection.js.map +1 -1
- package/dist/src/semantic-tool-presentation.js +76 -7
- package/dist/src/semantic-tool-presentation.js.map +1 -1
- package/dist/src/semantic-tool-runtime.js +129 -29
- package/dist/src/semantic-tool-runtime.js.map +1 -1
- package/dist/src/semantic-tool-schemas.d.ts +410 -27
- package/dist/src/semantic-tool-schemas.js +176 -88
- package/dist/src/semantic-tool-schemas.js.map +1 -1
- package/dist/src/terminal-action-contracts.js +10 -6
- package/dist/src/terminal-action-contracts.js.map +1 -1
- package/dist/src/terminal-list-cli-adapter.d.ts +1 -0
- package/dist/src/terminal-list-cli-adapter.js +6 -3
- package/dist/src/terminal-list-cli-adapter.js.map +1 -1
- package/dist/src/terminal-model-control-profile.d.ts +3 -1
- package/dist/src/terminal-model-control-profile.js +15 -7
- package/dist/src/terminal-model-control-profile.js.map +1 -1
- package/dist/src/terminal-monitor-decision-policy.d.ts +1 -1
- package/dist/src/terminal-native-inspection-profile.js +4 -0
- package/dist/src/terminal-native-inspection-profile.js.map +1 -1
- package/dist/src/terminal-permission-control-list-projection.d.ts +1 -1
- package/dist/src/terminal-permission-control.js +5 -1
- package/dist/src/terminal-permission-control.js.map +1 -1
- package/dist/src/terminal-questionnaire-adapter.js +5 -2
- package/dist/src/terminal-questionnaire-adapter.js.map +1 -1
- package/dist/src/terminal-user-send-intent.d.ts +2 -0
- package/dist/src/terminal-user-send-intent.js +11 -3
- package/dist/src/terminal-user-send-intent.js.map +1 -1
- package/docs/architecture/current-architecture.md +313 -0
- package/docs/architecture/interactive-terminal-response.md +276 -0
- package/docs/architecture/issue-126-final-report.md +248 -0
- package/docs/architecture/orchestration-refactor-history.md +2987 -0
- package/docs/architecture/orchestration-refactor.md +21 -0
- package/docs/backend-task-recovery.md +89 -0
- package/docs/bidirectional-agent-protocol.md +260 -0
- package/docs/codex-0.160.0-compatibility.md +126 -0
- package/docs/codex-cli-native-compatibility.md +246 -0
- package/docs/codex-desktop-compatibility.md +414 -0
- package/docs/codex-permissions.md +12 -1
- package/docs/openclaw-operations.md +281 -0
- package/docs/openclaw-session-turn-delivery-requirement.md +45 -0
- package/docs/operator-guide.md +543 -0
- package/docs/storage-and-logging.md +91 -0
- package/docs/test-performance-issue-108.md +80 -0
- package/docs/test-performance-issue-120.md +226 -0
- package/docs/testing.md +628 -0
- package/openclaw.plugin.json +7 -3
- package/package.json +6 -12
- package/templates/openclaw-skills/agent-knock-knock/SKILL.md +69 -18
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { backendCallbackMaxAttempts, backendObservationStopped } from "./backend-task-recovery.js";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { parseCallbackAttemptOutcome } from "./callback-transport.js";
|
|
4
|
+
import { createDurableNotificationLease, decideDurableNotificationRetry, reduceDurableNotificationSettlement } from "./durable-notification-kernel.js";
|
|
5
|
+
/** Lease and durable checkpoint semantics are shared with the other AKK transports. */
|
|
6
|
+
export function createNativeNotificationOutbox(deps) {
|
|
7
|
+
const now = deps.now ?? (() => new Date());
|
|
8
|
+
const uuid = deps.randomUUID ?? randomUUID;
|
|
9
|
+
const maxAttempts = deps.maxDeliveryAttempts ?? 4;
|
|
10
|
+
function update(id, operation) {
|
|
11
|
+
return deps.repository.withLock(id, () => {
|
|
12
|
+
const task = deps.repository.load(id);
|
|
13
|
+
if (!task)
|
|
14
|
+
throw new Error("Codex native Watch not found");
|
|
15
|
+
operation(task);
|
|
16
|
+
task.updated_at = now().toISOString();
|
|
17
|
+
return deps.repository.save(task, task.revision);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function stale(task, note) {
|
|
21
|
+
if (note.envelope.event.type === "codex_native_watch.timed_out") {
|
|
22
|
+
const expected = `${task.id}:timed_out${task.renewal_count ? `:${task.renewal_count}` : ""}`;
|
|
23
|
+
if (task.status !== "timed_out" || note.id !== expected)
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
const interactionId = note.envelope.event.metadata?.interaction_id;
|
|
27
|
+
return typeof interactionId === "string" && !task.pending_interactions.some(interaction => interaction.id === interactionId);
|
|
28
|
+
}
|
|
29
|
+
function settle(id, notificationId, attemptId, outcome) {
|
|
30
|
+
update(id, task => {
|
|
31
|
+
const n = task.notifications.find(candidate => candidate.id === notificationId);
|
|
32
|
+
if (!n || n.attempt_id !== attemptId)
|
|
33
|
+
return;
|
|
34
|
+
const lateAcceptance = outcome.disposition === "accepted" && n.status === "uncertain" &&
|
|
35
|
+
n.outcome?.disposition === "uncertain" && n.outcome.error_code === "codex_native_callback_lease_expired";
|
|
36
|
+
if (n.status !== "leased" && !lateAcceptance)
|
|
37
|
+
return;
|
|
38
|
+
if (outcome.disposition === "retryable_failure" && stale(task, n)) {
|
|
39
|
+
n.status = "failed";
|
|
40
|
+
n.outcome = { disposition: "permanent_failure", error_code: "codex_native_callback_stale" };
|
|
41
|
+
delete n.retry_at;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
n.outcome = outcome;
|
|
45
|
+
const result = reduceDurableNotificationSettlement({ attempt: n.attempts, outcome, retryEnabled: !backendObservationStopped(task) && !stale(task, n),
|
|
46
|
+
maxRetryAttempts: backendCallbackMaxAttempts(n, maxAttempts) - 1 });
|
|
47
|
+
if (result.state === "accepted")
|
|
48
|
+
n.status = "accepted";
|
|
49
|
+
else if (result.state === "failed" && result.retryAuthorized) {
|
|
50
|
+
n.status = "retry_wait";
|
|
51
|
+
n.retry_at = new Date(now().getTime() + (deps.retryDelayMs ?? 5000) * 2 ** (n.attempts - 1)).toISOString();
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
n.status = outcome.disposition === "uncertain" ? "uncertain" : "failed";
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
async deliverPending(id, notificationId) {
|
|
59
|
+
let claimed;
|
|
60
|
+
update(id, task => {
|
|
61
|
+
for (const n of task.notifications) {
|
|
62
|
+
if (notificationId && n.id !== notificationId)
|
|
63
|
+
continue;
|
|
64
|
+
if (n.status === "leased" && Date.parse(n.lease_expires_at) <= now().getTime()) {
|
|
65
|
+
n.status = "uncertain";
|
|
66
|
+
n.outcome = { disposition: "uncertain", error_code: "codex_native_callback_lease_expired", observed_at: now().toISOString() };
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (backendObservationStopped(task) || !deps.deliver)
|
|
70
|
+
continue;
|
|
71
|
+
if (["ready", "retry_wait"].includes(n.status) && stale(task, n)) {
|
|
72
|
+
n.status = "failed";
|
|
73
|
+
n.outcome = { disposition: "permanent_failure", error_code: "codex_native_callback_stale" };
|
|
74
|
+
delete n.retry_at;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const decision = decideDurableNotificationRetry(n.status === "ready"
|
|
78
|
+
? { phase: "ready", attempt: n.attempts, maxAttempts: backendCallbackMaxAttempts(n, maxAttempts) - 1 }
|
|
79
|
+
: n.status === "retry_wait"
|
|
80
|
+
? { phase: "retry_wait", attempt: n.attempts, maxAttempts: backendCallbackMaxAttempts(n, maxAttempts) - 1, nowMs: now().getTime(), retryAt: n.retry_at, retryAuthorized: true }
|
|
81
|
+
: { phase: "settled", attempt: n.attempts });
|
|
82
|
+
if (decision.state !== "retryable")
|
|
83
|
+
continue;
|
|
84
|
+
const lease = createDurableNotificationLease({ previousAttempts: n.attempts, attemptId: uuid(), attemptedAt: now().toISOString(),
|
|
85
|
+
leaseBaseMs: now().getTime(), leaseMs: deps.deliveryLeaseMs ?? 30_000 });
|
|
86
|
+
n.status = "leased";
|
|
87
|
+
n.attempts = lease.attempt;
|
|
88
|
+
n.attempt_id = lease.attemptId;
|
|
89
|
+
n.lease_expires_at = lease.leaseExpiresAt;
|
|
90
|
+
claimed = { task: structuredClone(task), notification: structuredClone(n) };
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
if (!claimed)
|
|
95
|
+
return;
|
|
96
|
+
const { task, notification: n } = claimed;
|
|
97
|
+
let outcome;
|
|
98
|
+
try {
|
|
99
|
+
const context = deps.resolveCallbackContext?.(task);
|
|
100
|
+
const current = deps.repository.load(id);
|
|
101
|
+
if (!current || backendObservationStopped(current) || stale(current, n)) {
|
|
102
|
+
settle(id, n.id, n.attempt_id, { disposition: "permanent_failure", error_code: "codex_native_callback_stopped" });
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
outcome = parseCallbackAttemptOutcome(await deps.deliver({ route: task.callback_route, envelope: n.envelope,
|
|
106
|
+
attempt: { number: n.attempts, id: n.attempt_id }, context,
|
|
107
|
+
reportCheckpoint: checkpoint => {
|
|
108
|
+
const parsed = parseCallbackAttemptOutcome(checkpoint);
|
|
109
|
+
if (parsed.disposition === "accepted")
|
|
110
|
+
settle(id, n.id, n.attempt_id, parsed);
|
|
111
|
+
} }));
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
outcome = { disposition: "uncertain", error_code: "codex_native_callback_outcome_unknown", observed_at: now().toISOString() };
|
|
115
|
+
}
|
|
116
|
+
settle(id, n.id, n.attempt_id, outcome);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=codex-native-outbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-native-outbox.js","sourceRoot":"","sources":["../../src/codex-native-outbox.ts"],"names":[],"mapp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askRecord, PersistedNativeInteraction } from "./codex-native-state-store.js";
|
|
2
|
+
import type { CodexNativeIdentity, CodexNativeSnapshot, CodexNativeTurn, NativeInteractionResponse } from "./codex-native-types.js";
|
|
3
|
+
/** Keep native request projections separate from terminal screen-derived questionnaire contracts. */
|
|
4
|
+
export declare function validateNativeInteractionProjections(value: unknown, conversationId: unknown, watchId?: unknown): unknown[];
|
|
5
|
+
export declare function nativeInteractionProjection(interaction: PersistedNativeInteraction, conversationId: string, watchId?: string): {
|
|
6
|
+
watch_id: string;
|
|
7
|
+
conversation_id?: undefined;
|
|
8
|
+
interaction_id: string;
|
|
9
|
+
kind: "async_question" | "blocking_question" | "command_approval" | "file_approval";
|
|
10
|
+
status: string;
|
|
11
|
+
native_thread_id: string;
|
|
12
|
+
native_turn_id: string;
|
|
13
|
+
command?: string | undefined;
|
|
14
|
+
reason?: string | undefined;
|
|
15
|
+
network?: {
|
|
16
|
+
host: string;
|
|
17
|
+
protocol: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
cwd?: string | undefined;
|
|
20
|
+
file_changes?: {
|
|
21
|
+
path: string;
|
|
22
|
+
kind?: string;
|
|
23
|
+
diff?: string;
|
|
24
|
+
diffTruncated?: boolean;
|
|
25
|
+
}[] | undefined;
|
|
26
|
+
delivery_modes?: string[] | undefined;
|
|
27
|
+
questions: {
|
|
28
|
+
question_id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
is_secret?: boolean | undefined;
|
|
31
|
+
response_kind: string;
|
|
32
|
+
allow_free_text: boolean;
|
|
33
|
+
options: {
|
|
34
|
+
option_id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
}[];
|
|
37
|
+
}[];
|
|
38
|
+
available_actions: {
|
|
39
|
+
approve: {
|
|
40
|
+
tool: string;
|
|
41
|
+
input: {
|
|
42
|
+
watch_id: string;
|
|
43
|
+
conversation_id?: undefined;
|
|
44
|
+
interaction_id: string;
|
|
45
|
+
} | {
|
|
46
|
+
watch_id?: undefined;
|
|
47
|
+
conversation_id: string;
|
|
48
|
+
interaction_id: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
respond?: undefined;
|
|
52
|
+
} | {
|
|
53
|
+
approve?: undefined;
|
|
54
|
+
respond: {
|
|
55
|
+
tool: string;
|
|
56
|
+
input: {
|
|
57
|
+
watch_id: string;
|
|
58
|
+
conversation_id?: undefined;
|
|
59
|
+
interaction_id: string;
|
|
60
|
+
} | {
|
|
61
|
+
watch_id?: undefined;
|
|
62
|
+
conversation_id: string;
|
|
63
|
+
interaction_id: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
} | {
|
|
68
|
+
watch_id?: undefined;
|
|
69
|
+
conversation_id: string;
|
|
70
|
+
interaction_id: string;
|
|
71
|
+
kind: "async_question" | "blocking_question" | "command_approval" | "file_approval";
|
|
72
|
+
status: string;
|
|
73
|
+
native_thread_id: string;
|
|
74
|
+
native_turn_id: string;
|
|
75
|
+
command?: string | undefined;
|
|
76
|
+
reason?: string | undefined;
|
|
77
|
+
network?: {
|
|
78
|
+
host: string;
|
|
79
|
+
protocol: string;
|
|
80
|
+
} | undefined;
|
|
81
|
+
cwd?: string | undefined;
|
|
82
|
+
file_changes?: {
|
|
83
|
+
path: string;
|
|
84
|
+
kind?: string;
|
|
85
|
+
diff?: string;
|
|
86
|
+
diffTruncated?: boolean;
|
|
87
|
+
}[] | undefined;
|
|
88
|
+
delivery_modes?: string[] | undefined;
|
|
89
|
+
questions: {
|
|
90
|
+
question_id: string;
|
|
91
|
+
title: string;
|
|
92
|
+
is_secret?: boolean | undefined;
|
|
93
|
+
response_kind: string;
|
|
94
|
+
allow_free_text: boolean;
|
|
95
|
+
options: {
|
|
96
|
+
option_id: string;
|
|
97
|
+
label: string;
|
|
98
|
+
}[];
|
|
99
|
+
}[];
|
|
100
|
+
available_actions: {
|
|
101
|
+
approve: {
|
|
102
|
+
tool: string;
|
|
103
|
+
input: {
|
|
104
|
+
watch_id: string;
|
|
105
|
+
conversation_id?: undefined;
|
|
106
|
+
interaction_id: string;
|
|
107
|
+
} | {
|
|
108
|
+
watch_id?: undefined;
|
|
109
|
+
conversation_id: string;
|
|
110
|
+
interaction_id: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
respond?: undefined;
|
|
114
|
+
} | {
|
|
115
|
+
approve?: undefined;
|
|
116
|
+
respond: {
|
|
117
|
+
tool: string;
|
|
118
|
+
input: {
|
|
119
|
+
watch_id: string;
|
|
120
|
+
conversation_id?: undefined;
|
|
121
|
+
interaction_id: string;
|
|
122
|
+
} | {
|
|
123
|
+
watch_id?: undefined;
|
|
124
|
+
conversation_id: string;
|
|
125
|
+
interaction_id: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/** Resolve advertised opaque IDs against fresh native questions, never against labels supplied by a caller. */
|
|
131
|
+
export declare function nativeQuestionResponse(interaction: PersistedNativeInteraction, value: unknown): NativeInteractionResponse;
|
|
132
|
+
export declare function nativeTurnProjection(turn: CodexNativeTurn | undefined): {
|
|
133
|
+
id: string;
|
|
134
|
+
status: "completed" | "failed" | "inProgress" | "interrupted";
|
|
135
|
+
items_complete: boolean;
|
|
136
|
+
final_text: string;
|
|
137
|
+
} | {
|
|
138
|
+
id: string;
|
|
139
|
+
status: "completed" | "failed" | "inProgress" | "interrupted";
|
|
140
|
+
items_complete: boolean;
|
|
141
|
+
response_text: string;
|
|
142
|
+
} | null;
|
|
143
|
+
export declare function codexNativeSessionProjection(identity: CodexNativeIdentity, snapshot: CodexNativeSnapshot, backendVersion: string, interactionsScanned?: boolean): {
|
|
144
|
+
id: string;
|
|
145
|
+
conversation_id: string;
|
|
146
|
+
source: string;
|
|
147
|
+
agent: string;
|
|
148
|
+
title: {};
|
|
149
|
+
cwd: string;
|
|
150
|
+
native_thread_id: string;
|
|
151
|
+
native_turn_id: string | null;
|
|
152
|
+
backend_version: string;
|
|
153
|
+
connection_state: string;
|
|
154
|
+
activity_state: "active" | "idle" | "notLoaded" | "systemError";
|
|
155
|
+
active_flags: ("waitingOnApproval" | "waitingOnUserInput")[];
|
|
156
|
+
interaction_requests_scanned: boolean;
|
|
157
|
+
pending_interaction_count: number | null;
|
|
158
|
+
attention_required: boolean;
|
|
159
|
+
capabilities: {
|
|
160
|
+
status: boolean;
|
|
161
|
+
send: boolean;
|
|
162
|
+
watch: boolean;
|
|
163
|
+
interaction_notify: boolean;
|
|
164
|
+
interaction_respond: boolean;
|
|
165
|
+
approve: boolean;
|
|
166
|
+
set_permissions: boolean;
|
|
167
|
+
};
|
|
168
|
+
interaction_state: ({
|
|
169
|
+
watch_id: string;
|
|
170
|
+
conversation_id?: undefined;
|
|
171
|
+
interaction_id: string;
|
|
172
|
+
kind: "async_question" | "blocking_question" | "command_approval" | "file_approval";
|
|
173
|
+
status: string;
|
|
174
|
+
native_thread_id: string;
|
|
175
|
+
native_turn_id: string;
|
|
176
|
+
command?: string | undefined;
|
|
177
|
+
reason?: string | undefined;
|
|
178
|
+
network?: {
|
|
179
|
+
host: string;
|
|
180
|
+
protocol: string;
|
|
181
|
+
} | undefined;
|
|
182
|
+
cwd?: string | undefined;
|
|
183
|
+
file_changes?: {
|
|
184
|
+
path: string;
|
|
185
|
+
kind?: string;
|
|
186
|
+
diff?: string;
|
|
187
|
+
diffTruncated?: boolean;
|
|
188
|
+
}[] | undefined;
|
|
189
|
+
delivery_modes?: string[] | undefined;
|
|
190
|
+
questions: {
|
|
191
|
+
question_id: string;
|
|
192
|
+
title: string;
|
|
193
|
+
is_secret?: boolean | undefined;
|
|
194
|
+
response_kind: string;
|
|
195
|
+
allow_free_text: boolean;
|
|
196
|
+
options: {
|
|
197
|
+
option_id: string;
|
|
198
|
+
label: string;
|
|
199
|
+
}[];
|
|
200
|
+
}[];
|
|
201
|
+
available_actions: {
|
|
202
|
+
approve: {
|
|
203
|
+
tool: string;
|
|
204
|
+
input: {
|
|
205
|
+
watch_id: string;
|
|
206
|
+
conversation_id?: undefined;
|
|
207
|
+
interaction_id: string;
|
|
208
|
+
} | {
|
|
209
|
+
watch_id?: undefined;
|
|
210
|
+
conversation_id: string;
|
|
211
|
+
interaction_id: string;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
respond?: undefined;
|
|
215
|
+
} | {
|
|
216
|
+
approve?: undefined;
|
|
217
|
+
respond: {
|
|
218
|
+
tool: string;
|
|
219
|
+
input: {
|
|
220
|
+
watch_id: string;
|
|
221
|
+
conversation_id?: undefined;
|
|
222
|
+
interaction_id: string;
|
|
223
|
+
} | {
|
|
224
|
+
watch_id?: undefined;
|
|
225
|
+
conversation_id: string;
|
|
226
|
+
interaction_id: string;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
} | {
|
|
231
|
+
watch_id?: undefined;
|
|
232
|
+
conversation_id: string;
|
|
233
|
+
interaction_id: string;
|
|
234
|
+
kind: "async_question" | "blocking_question" | "command_approval" | "file_approval";
|
|
235
|
+
status: string;
|
|
236
|
+
native_thread_id: string;
|
|
237
|
+
native_turn_id: string;
|
|
238
|
+
command?: string | undefined;
|
|
239
|
+
reason?: string | undefined;
|
|
240
|
+
network?: {
|
|
241
|
+
host: string;
|
|
242
|
+
protocol: string;
|
|
243
|
+
} | undefined;
|
|
244
|
+
cwd?: string | undefined;
|
|
245
|
+
file_changes?: {
|
|
246
|
+
path: string;
|
|
247
|
+
kind?: string;
|
|
248
|
+
diff?: string;
|
|
249
|
+
diffTruncated?: boolean;
|
|
250
|
+
}[] | undefined;
|
|
251
|
+
delivery_modes?: string[] | undefined;
|
|
252
|
+
questions: {
|
|
253
|
+
question_id: string;
|
|
254
|
+
title: string;
|
|
255
|
+
is_secret?: boolean | undefined;
|
|
256
|
+
response_kind: string;
|
|
257
|
+
allow_free_text: boolean;
|
|
258
|
+
options: {
|
|
259
|
+
option_id: string;
|
|
260
|
+
label: string;
|
|
261
|
+
}[];
|
|
262
|
+
}[];
|
|
263
|
+
available_actions: {
|
|
264
|
+
approve: {
|
|
265
|
+
tool: string;
|
|
266
|
+
input: {
|
|
267
|
+
watch_id: string;
|
|
268
|
+
conversation_id?: undefined;
|
|
269
|
+
interaction_id: string;
|
|
270
|
+
} | {
|
|
271
|
+
watch_id?: undefined;
|
|
272
|
+
conversation_id: string;
|
|
273
|
+
interaction_id: string;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
respond?: undefined;
|
|
277
|
+
} | {
|
|
278
|
+
approve?: undefined;
|
|
279
|
+
respond: {
|
|
280
|
+
tool: string;
|
|
281
|
+
input: {
|
|
282
|
+
watch_id: string;
|
|
283
|
+
conversation_id?: undefined;
|
|
284
|
+
interaction_id: string;
|
|
285
|
+
} | {
|
|
286
|
+
watch_id?: undefined;
|
|
287
|
+
conversation_id: string;
|
|
288
|
+
interaction_id: string;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
})[];
|
|
293
|
+
latest_turn: {
|
|
294
|
+
id: string;
|
|
295
|
+
status: "completed" | "failed" | "inProgress" | "interrupted";
|
|
296
|
+
items_complete: boolean;
|
|
297
|
+
final_text: string;
|
|
298
|
+
} | {
|
|
299
|
+
id: string;
|
|
300
|
+
status: "completed" | "failed" | "inProgress" | "interrupted";
|
|
301
|
+
items_complete: boolean;
|
|
302
|
+
response_text: string;
|
|
303
|
+
} | null;
|
|
304
|
+
available_actions: {
|
|
305
|
+
status: {
|
|
306
|
+
tool: string;
|
|
307
|
+
input: {
|
|
308
|
+
conversation_id: string;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
send?: {
|
|
312
|
+
tool: string;
|
|
313
|
+
input: {
|
|
314
|
+
conversation_id: string;
|
|
315
|
+
};
|
|
316
|
+
} | undefined;
|
|
317
|
+
watch?: {
|
|
318
|
+
tool: string;
|
|
319
|
+
input: {
|
|
320
|
+
conversation_id: string;
|
|
321
|
+
};
|
|
322
|
+
} | undefined;
|
|
323
|
+
permission_options?: {
|
|
324
|
+
tool: string;
|
|
325
|
+
input: {
|
|
326
|
+
conversation_id: string;
|
|
327
|
+
};
|
|
328
|
+
} | undefined;
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
export declare function codexNativeTaskProjection(task: CodexNativeTaskRecord): {
|
|
332
|
+
task_kind: "send" | "watch";
|
|
333
|
+
turn_id?: string | undefined;
|
|
334
|
+
management_state: string;
|
|
335
|
+
observation_state: string;
|
|
336
|
+
deadline_at: string;
|
|
337
|
+
renewal_count: number;
|
|
338
|
+
closed_at: string | undefined;
|
|
339
|
+
close_reason: string | undefined;
|
|
340
|
+
unwatched_at: string | undefined;
|
|
341
|
+
renewed_at: string | undefined;
|
|
342
|
+
recovered_at: string | undefined;
|
|
343
|
+
callback_in_flight: boolean;
|
|
344
|
+
retryable_callback_ids: string[];
|
|
345
|
+
watch_id: string;
|
|
346
|
+
conversation_id: string;
|
|
347
|
+
source: string;
|
|
348
|
+
status: string;
|
|
349
|
+
observation_status: import("./codex-native-state-store.js").CodexNativeTaskStatus;
|
|
350
|
+
observation_active: boolean;
|
|
351
|
+
available_actions: {
|
|
352
|
+
recover?: {
|
|
353
|
+
tool: string;
|
|
354
|
+
input: {
|
|
355
|
+
watch_id: string;
|
|
356
|
+
};
|
|
357
|
+
} | undefined;
|
|
358
|
+
renew?: {
|
|
359
|
+
tool: string;
|
|
360
|
+
input: {
|
|
361
|
+
watch_id: string;
|
|
362
|
+
};
|
|
363
|
+
} | undefined;
|
|
364
|
+
unwatch?: {
|
|
365
|
+
tool: string;
|
|
366
|
+
input: {
|
|
367
|
+
watch_id: string;
|
|
368
|
+
};
|
|
369
|
+
} | undefined;
|
|
370
|
+
close?: {
|
|
371
|
+
tool: string;
|
|
372
|
+
input: {
|
|
373
|
+
turn_id: string;
|
|
374
|
+
};
|
|
375
|
+
} | undefined;
|
|
376
|
+
retry_callback?: {
|
|
377
|
+
tool: string;
|
|
378
|
+
input: {
|
|
379
|
+
watch_id: string;
|
|
380
|
+
notification_id: string;
|
|
381
|
+
};
|
|
382
|
+
} | undefined;
|
|
383
|
+
};
|
|
384
|
+
native_thread_id: string;
|
|
385
|
+
native_turn_id: string | null;
|
|
386
|
+
observation_mode: string;
|
|
387
|
+
anchor_state: string;
|
|
388
|
+
created_at: string;
|
|
389
|
+
updated_at: string;
|
|
390
|
+
observed_at: string | undefined;
|
|
391
|
+
observation_error: string | undefined;
|
|
392
|
+
final_text: string | undefined;
|
|
393
|
+
pending_interaction_count: number;
|
|
394
|
+
interaction_state: ({
|
|
395
|
+
watch_id: string;
|
|
396
|
+
conversation_id?: undefined;
|
|
397
|
+
interaction_id: string;
|
|
398
|
+
kind: "async_question" | "blocking_question" | "command_approval" | "file_approval";
|
|
399
|
+
status: string;
|
|
400
|
+
native_thread_id: string;
|
|
401
|
+
native_turn_id: string;
|
|
402
|
+
command?: string | undefined;
|
|
403
|
+
reason?: string | undefined;
|
|
404
|
+
network?: {
|
|
405
|
+
host: string;
|
|
406
|
+
protocol: string;
|
|
407
|
+
} | undefined;
|
|
408
|
+
cwd?: string | undefined;
|
|
409
|
+
file_changes?: {
|
|
410
|
+
path: string;
|
|
411
|
+
kind?: string;
|
|
412
|
+
diff?: string;
|
|
413
|
+
diffTruncated?: boolean;
|
|
414
|
+
}[] | undefined;
|
|
415
|
+
delivery_modes?: string[] | undefined;
|
|
416
|
+
questions: {
|
|
417
|
+
question_id: string;
|
|
418
|
+
title: string;
|
|
419
|
+
is_secret?: boolean | undefined;
|
|
420
|
+
response_kind: string;
|
|
421
|
+
allow_free_text: boolean;
|
|
422
|
+
options: {
|
|
423
|
+
option_id: string;
|
|
424
|
+
label: string;
|
|
425
|
+
}[];
|
|
426
|
+
}[];
|
|
427
|
+
available_actions: {
|
|
428
|
+
approve: {
|
|
429
|
+
tool: string;
|
|
430
|
+
input: {
|
|
431
|
+
watch_id: string;
|
|
432
|
+
conversation_id?: undefined;
|
|
433
|
+
interaction_id: string;
|
|
434
|
+
} | {
|
|
435
|
+
watch_id?: undefined;
|
|
436
|
+
conversation_id: string;
|
|
437
|
+
interaction_id: string;
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
respond?: undefined;
|
|
441
|
+
} | {
|
|
442
|
+
approve?: undefined;
|
|
443
|
+
respond: {
|
|
444
|
+
tool: string;
|
|
445
|
+
input: {
|
|
446
|
+
watch_id: string;
|
|
447
|
+
conversation_id?: undefined;
|
|
448
|
+
interaction_id: string;
|
|
449
|
+
} | {
|
|
450
|
+
watch_id?: undefined;
|
|
451
|
+
conversation_id: string;
|
|
452
|
+
interaction_id: string;
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
} | {
|
|
457
|
+
watch_id?: undefined;
|
|
458
|
+
conversation_id: string;
|
|
459
|
+
interaction_id: string;
|
|
460
|
+
kind: "async_question" | "blocking_question" | "command_approval" | "file_approval";
|
|
461
|
+
status: string;
|
|
462
|
+
native_thread_id: string;
|
|
463
|
+
native_turn_id: string;
|
|
464
|
+
command?: string | undefined;
|
|
465
|
+
reason?: string | undefined;
|
|
466
|
+
network?: {
|
|
467
|
+
host: string;
|
|
468
|
+
protocol: string;
|
|
469
|
+
} | undefined;
|
|
470
|
+
cwd?: string | undefined;
|
|
471
|
+
file_changes?: {
|
|
472
|
+
path: string;
|
|
473
|
+
kind?: string;
|
|
474
|
+
diff?: string;
|
|
475
|
+
diffTruncated?: boolean;
|
|
476
|
+
}[] | undefined;
|
|
477
|
+
delivery_modes?: string[] | undefined;
|
|
478
|
+
questions: {
|
|
479
|
+
question_id: string;
|
|
480
|
+
title: string;
|
|
481
|
+
is_secret?: boolean | undefined;
|
|
482
|
+
response_kind: string;
|
|
483
|
+
allow_free_text: boolean;
|
|
484
|
+
options: {
|
|
485
|
+
option_id: string;
|
|
486
|
+
label: string;
|
|
487
|
+
}[];
|
|
488
|
+
}[];
|
|
489
|
+
available_actions: {
|
|
490
|
+
approve: {
|
|
491
|
+
tool: string;
|
|
492
|
+
input: {
|
|
493
|
+
watch_id: string;
|
|
494
|
+
conversation_id?: undefined;
|
|
495
|
+
interaction_id: string;
|
|
496
|
+
} | {
|
|
497
|
+
watch_id?: undefined;
|
|
498
|
+
conversation_id: string;
|
|
499
|
+
interaction_id: string;
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
respond?: undefined;
|
|
503
|
+
} | {
|
|
504
|
+
approve?: undefined;
|
|
505
|
+
respond: {
|
|
506
|
+
tool: string;
|
|
507
|
+
input: {
|
|
508
|
+
watch_id: string;
|
|
509
|
+
conversation_id?: undefined;
|
|
510
|
+
interaction_id: string;
|
|
511
|
+
} | {
|
|
512
|
+
watch_id?: undefined;
|
|
513
|
+
conversation_id: string;
|
|
514
|
+
interaction_id: string;
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
})[];
|
|
519
|
+
callback_configured: boolean;
|
|
520
|
+
callback_expected: boolean;
|
|
521
|
+
callback_notifications: {
|
|
522
|
+
id: string;
|
|
523
|
+
notification_id: string;
|
|
524
|
+
status: "accepted" | "failed" | "leased" | "ready" | "retry_wait" | "uncertain";
|
|
525
|
+
attempts: number;
|
|
526
|
+
error_code?: string | undefined;
|
|
527
|
+
}[];
|
|
528
|
+
capabilities: {
|
|
529
|
+
close: boolean;
|
|
530
|
+
renew: boolean;
|
|
531
|
+
recover: boolean;
|
|
532
|
+
retry_callback: boolean;
|
|
533
|
+
callback: boolean;
|
|
534
|
+
interaction_notify: boolean;
|
|
535
|
+
interaction_respond: boolean;
|
|
536
|
+
approve: boolean;
|
|
537
|
+
};
|
|
538
|
+
message_id?: string | undefined;
|
|
539
|
+
delivered?: boolean | undefined;
|
|
540
|
+
send_state?: "accepted" | "not_sent" | "reserved" | "uncertain" | undefined;
|
|
541
|
+
delivery_receipt?: string | undefined;
|
|
542
|
+
agent_acceptance?: string | undefined;
|
|
543
|
+
send_error?: string | undefined;
|
|
544
|
+
resend_allowed?: boolean | undefined;
|
|
545
|
+
};
|