@scotthuang/agent-knock-knock 0.12.11 → 0.12.13
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 +40 -0
- package/README.md +43 -30
- package/dist/src/approval-policy.d.ts +11 -2
- package/dist/src/approval-policy.js +33 -7
- package/dist/src/approval-policy.js.map +1 -1
- package/dist/src/callback-cli-adapter.d.ts +47 -0
- package/dist/src/callback-cli-adapter.js +156 -0
- package/dist/src/callback-cli-adapter.js.map +1 -0
- package/dist/src/callback-outbox-policy.d.ts +95 -0
- package/dist/src/callback-outbox-policy.js +149 -0
- package/dist/src/callback-outbox-policy.js.map +1 -0
- package/dist/src/callback-outbox-service.d.ts +247 -0
- package/dist/src/callback-outbox-service.js +1053 -0
- package/dist/src/callback-outbox-service.js.map +1 -0
- package/dist/src/callback-outbox-settlement.d.ts +54 -0
- package/dist/src/callback-outbox-settlement.js +241 -0
- package/dist/src/callback-outbox-settlement.js.map +1 -0
- package/dist/src/canonical-json.d.ts +1 -0
- package/dist/src/canonical-json.js +14 -0
- package/dist/src/canonical-json.js.map +1 -0
- package/dist/src/claude-lifecycle-compatibility.js +15 -0
- package/dist/src/claude-lifecycle-compatibility.js.map +1 -1
- package/dist/src/claude-local-transcript-provider.d.ts +82 -1
- package/dist/src/claude-local-transcript-provider.js +873 -23
- package/dist/src/claude-local-transcript-provider.js.map +1 -1
- package/dist/src/cli-command-runtime.d.ts +14 -0
- package/dist/src/cli-command-runtime.js +164 -0
- package/dist/src/cli-command-runtime.js.map +1 -0
- package/dist/src/cli-core.d.ts +4 -42
- package/dist/src/cli-core.js +958 -28684
- package/dist/src/cli-core.js.map +1 -1
- package/dist/src/cli-runtime-context.d.ts +57 -0
- package/dist/src/cli-runtime-context.js +118 -0
- package/dist/src/cli-runtime-context.js.map +1 -0
- package/dist/src/codex-lifecycle-compatibility.js +2 -1
- package/dist/src/codex-lifecycle-compatibility.js.map +1 -1
- package/dist/src/codex-local-session-provider.d.ts +18 -0
- package/dist/src/codex-local-session-provider.js +67 -0
- package/dist/src/codex-local-session-provider.js.map +1 -1
- package/dist/src/codex-session-provider.js +1 -3
- package/dist/src/codex-session-provider.js.map +1 -1
- package/dist/src/conversation-trace.d.ts +30 -0
- package/dist/src/conversation-trace.js +185 -0
- package/dist/src/conversation-trace.js.map +1 -0
- package/dist/src/deferred-foreground-application-service.d.ts +84 -0
- package/dist/src/deferred-foreground-application-service.js +742 -0
- package/dist/src/deferred-foreground-application-service.js.map +1 -0
- package/dist/src/deferred-foreground-authority-cli-adapter.d.ts +78 -0
- package/dist/src/deferred-foreground-authority-cli-adapter.js +795 -0
- package/dist/src/deferred-foreground-authority-cli-adapter.js.map +1 -0
- package/dist/src/deferred-foreground-boundary.d.ts +61 -0
- package/dist/src/deferred-foreground-boundary.js +2 -0
- package/dist/src/deferred-foreground-boundary.js.map +1 -0
- package/dist/src/deferred-foreground-capability.d.ts +4 -0
- package/dist/src/deferred-foreground-capability.js +184 -0
- package/dist/src/deferred-foreground-capability.js.map +1 -0
- package/dist/src/deferred-foreground-preparation-cli-adapter.d.ts +53 -0
- package/dist/src/deferred-foreground-preparation-cli-adapter.js +210 -0
- package/dist/src/deferred-foreground-preparation-cli-adapter.js.map +1 -0
- package/dist/src/deferred-foreground-preparation-service.d.ts +72 -0
- package/dist/src/deferred-foreground-preparation-service.js +179 -0
- package/dist/src/deferred-foreground-preparation-service.js.map +1 -0
- package/dist/src/deferred-foreground-recovery-cli-adapter.d.ts +139 -0
- package/dist/src/deferred-foreground-recovery-cli-adapter.js +1125 -0
- package/dist/src/deferred-foreground-recovery-cli-adapter.js.map +1 -0
- package/dist/src/deferred-foreground-recovery-service.d.ts +48 -0
- package/dist/src/deferred-foreground-recovery-service.js +91 -0
- package/dist/src/deferred-foreground-recovery-service.js.map +1 -0
- package/dist/src/deferred-foreground-transfer-policy.d.ts +2 -0
- package/dist/src/deferred-foreground-transfer-policy.js +10 -0
- package/dist/src/deferred-foreground-transfer-policy.js.map +1 -0
- package/dist/src/deferred-foreground-transfer.js +46 -105
- package/dist/src/deferred-foreground-transfer.js.map +1 -1
- package/dist/src/doctor-capabilities.d.ts +9 -0
- package/dist/src/doctor-capabilities.js +22 -0
- package/dist/src/doctor-capabilities.js.map +1 -1
- package/dist/src/durable-json-file.d.ts +22 -0
- package/dist/src/durable-json-file.js +127 -0
- package/dist/src/durable-json-file.js.map +1 -0
- package/dist/src/file-lock-cli-adapter.d.ts +43 -0
- package/dist/src/file-lock-cli-adapter.js +150 -0
- package/dist/src/file-lock-cli-adapter.js.map +1 -0
- package/dist/src/herdr-terminal-control-provider.js +1 -3
- package/dist/src/herdr-terminal-control-provider.js.map +1 -1
- package/dist/src/install-doctor-command-adapter.d.ts +17 -0
- package/dist/src/install-doctor-command-adapter.js +225 -0
- package/dist/src/install-doctor-command-adapter.js.map +1 -0
- package/dist/src/live-lifecycle-evidence.js +76 -46
- package/dist/src/live-lifecycle-evidence.js.map +1 -1
- package/dist/src/live-lifecycle-smoke.js +74 -50
- package/dist/src/live-lifecycle-smoke.js.map +1 -1
- package/dist/src/managed-session.d.ts +2 -0
- package/dist/src/managed-session.js +24 -0
- package/dist/src/managed-session.js.map +1 -1
- package/dist/src/managed-turn-recovery-service.d.ts +86 -0
- package/dist/src/managed-turn-recovery-service.js +145 -0
- package/dist/src/managed-turn-recovery-service.js.map +1 -0
- package/dist/src/mutation-transaction.d.ts +48 -0
- package/dist/src/mutation-transaction.js +73 -0
- package/dist/src/mutation-transaction.js.map +1 -0
- package/dist/src/native-thread-lifecycle-cli-adapter.d.ts +154 -0
- package/dist/src/native-thread-lifecycle-cli-adapter.js +786 -0
- package/dist/src/native-thread-lifecycle-cli-adapter.js.map +1 -0
- package/dist/src/native-thread-lifecycle-ledger-cli-adapter.d.ts +25 -0
- package/dist/src/native-thread-lifecycle-ledger-cli-adapter.js +50 -0
- package/dist/src/native-thread-lifecycle-ledger-cli-adapter.js.map +1 -0
- package/dist/src/native-thread-lifecycle-query-service.d.ts +75 -0
- package/dist/src/native-thread-lifecycle-query-service.js +297 -0
- package/dist/src/native-thread-lifecycle-query-service.js.map +1 -0
- package/dist/src/native-thread-lifecycle-recovery-adapter.d.ts +45 -0
- package/dist/src/native-thread-lifecycle-recovery-adapter.js +154 -0
- package/dist/src/native-thread-lifecycle-recovery-adapter.js.map +1 -0
- package/dist/src/native-thread-lifecycle-recovery-service.d.ts +211 -0
- package/dist/src/native-thread-lifecycle-recovery-service.js +1093 -0
- package/dist/src/native-thread-lifecycle-recovery-service.js.map +1 -0
- package/dist/src/native-thread-resume-snapshot-policy.d.ts +73 -0
- package/dist/src/native-thread-resume-snapshot-policy.js +218 -0
- package/dist/src/native-thread-resume-snapshot-policy.js.map +1 -0
- package/dist/src/native-thread-resume-snapshot.d.ts +3 -61
- package/dist/src/native-thread-resume-snapshot.js +2 -143
- package/dist/src/native-thread-resume-snapshot.js.map +1 -1
- package/dist/src/native-thread-transition-application.d.ts +147 -0
- package/dist/src/native-thread-transition-application.js +974 -0
- package/dist/src/native-thread-transition-application.js.map +1 -0
- package/dist/src/native-thread-transition-policy.d.ts +127 -0
- package/dist/src/native-thread-transition-policy.js +154 -0
- package/dist/src/native-thread-transition-policy.js.map +1 -0
- package/dist/src/native-thread-transition-resource-adapter.d.ts +12 -0
- package/dist/src/native-thread-transition-resource-adapter.js +44 -0
- package/dist/src/native-thread-transition-resource-adapter.js.map +1 -0
- package/dist/src/native-thread-transition-settlement-service.d.ts +94 -0
- package/dist/src/native-thread-transition-settlement-service.js +134 -0
- package/dist/src/native-thread-transition-settlement-service.js.map +1 -0
- package/dist/src/native-thread-transition-verification-adapter.d.ts +62 -0
- package/dist/src/native-thread-transition-verification-adapter.js +451 -0
- package/dist/src/native-thread-transition-verification-adapter.js.map +1 -0
- package/dist/src/openclaw-callback-transport.d.ts +69 -0
- package/dist/src/openclaw-callback-transport.js +583 -0
- package/dist/src/openclaw-callback-transport.js.map +1 -0
- package/dist/src/openclaw-plugin-callback-adapter.d.ts +1 -0
- package/dist/src/openclaw-plugin-callback-adapter.js +423 -0
- package/dist/src/openclaw-plugin-callback-adapter.js.map +1 -0
- package/dist/src/openclaw-plugin-command-adapter.d.ts +16 -0
- package/dist/src/openclaw-plugin-command-adapter.js +1868 -0
- package/dist/src/openclaw-plugin-command-adapter.js.map +1 -0
- package/dist/src/openclaw-plugin-helpers.d.ts +27 -4
- package/dist/src/openclaw-plugin-helpers.js +356 -81
- package/dist/src/openclaw-plugin-helpers.js.map +1 -1
- package/dist/src/openclaw-plugin-schemas.d.ts +358 -0
- package/dist/src/openclaw-plugin-schemas.js +366 -0
- package/dist/src/openclaw-plugin-schemas.js.map +1 -0
- package/dist/src/openclaw-plugin-supervisor.d.ts +6 -0
- package/dist/src/openclaw-plugin-supervisor.js +123 -0
- package/dist/src/openclaw-plugin-supervisor.js.map +1 -0
- package/dist/src/openclaw-plugin.js +7 -2212
- package/dist/src/openclaw-plugin.js.map +1 -1
- package/dist/src/openclaw-private-authority-offers.d.ts +22 -0
- package/dist/src/openclaw-private-authority-offers.js +177 -0
- package/dist/src/openclaw-private-authority-offers.js.map +1 -0
- package/dist/src/protocol.d.ts +5 -0
- package/dist/src/protocol.js +59 -3
- package/dist/src/protocol.js.map +1 -1
- package/dist/src/session-store.d.ts +1 -0
- package/dist/src/session-store.js +84 -106
- package/dist/src/session-store.js.map +1 -1
- package/dist/src/store.d.ts +1 -0
- package/dist/src/store.js +5 -2
- package/dist/src/store.js.map +1 -1
- package/dist/src/terminal-acceptance-application-service.d.ts +65 -0
- package/dist/src/terminal-acceptance-application-service.js +63 -0
- package/dist/src/terminal-acceptance-application-service.js.map +1 -0
- package/dist/src/terminal-acceptance-cli-adapter.d.ts +210 -0
- package/dist/src/terminal-acceptance-cli-adapter.js +957 -0
- package/dist/src/terminal-acceptance-cli-adapter.js.map +1 -0
- package/dist/src/terminal-action-projection.d.ts +309 -0
- package/dist/src/terminal-action-projection.js +376 -0
- package/dist/src/terminal-action-projection.js.map +1 -0
- package/dist/src/terminal-agent-bridge.d.ts +3 -0
- package/dist/src/terminal-agent-bridge.js +29 -8
- package/dist/src/terminal-agent-bridge.js.map +1 -1
- package/dist/src/terminal-authority-policy.d.ts +141 -0
- package/dist/src/terminal-authority-policy.js +367 -0
- package/dist/src/terminal-authority-policy.js.map +1 -0
- package/dist/src/terminal-binding-authority.d.ts +118 -0
- package/dist/src/terminal-binding-authority.js +245 -0
- package/dist/src/terminal-binding-authority.js.map +1 -0
- package/dist/src/terminal-binding-reconciliation-service.d.ts +75 -0
- package/dist/src/terminal-binding-reconciliation-service.js +73 -0
- package/dist/src/terminal-binding-reconciliation-service.js.map +1 -0
- package/dist/src/terminal-command-cli-adapter.d.ts +380 -0
- package/dist/src/terminal-command-cli-adapter.js +3288 -0
- package/dist/src/terminal-command-cli-adapter.js.map +1 -0
- package/dist/src/terminal-control-ref.d.ts +4 -0
- package/dist/src/terminal-control-ref.js +11 -8
- package/dist/src/terminal-control-ref.js.map +1 -1
- package/dist/src/terminal-delegate-cli-adapter.d.ts +41 -0
- package/dist/src/terminal-delegate-cli-adapter.js +242 -0
- package/dist/src/terminal-delegate-cli-adapter.js.map +1 -0
- package/dist/src/terminal-dispatch-abort.d.ts +22 -0
- package/dist/src/terminal-dispatch-abort.js +30 -0
- package/dist/src/terminal-dispatch-abort.js.map +1 -0
- package/dist/src/terminal-dispatch-application.d.ts +115 -0
- package/dist/src/terminal-dispatch-application.js +478 -0
- package/dist/src/terminal-dispatch-application.js.map +1 -0
- package/dist/src/terminal-dispatch-capability.d.ts +63 -0
- package/dist/src/terminal-dispatch-capability.js +133 -0
- package/dist/src/terminal-dispatch-capability.js.map +1 -0
- package/dist/src/terminal-dispatch-completion-cli-adapter.d.ts +22 -0
- package/dist/src/terminal-dispatch-completion-cli-adapter.js +96 -0
- package/dist/src/terminal-dispatch-completion-cli-adapter.js.map +1 -0
- package/dist/src/terminal-dispatch-composition.d.ts +79 -0
- package/dist/src/terminal-dispatch-composition.js +2 -0
- package/dist/src/terminal-dispatch-composition.js.map +1 -0
- package/dist/src/terminal-dispatch-execution.d.ts +290 -0
- package/dist/src/terminal-dispatch-execution.js +916 -0
- package/dist/src/terminal-dispatch-execution.js.map +1 -0
- package/dist/src/terminal-dispatch-ledger-codec.d.ts +110 -0
- package/dist/src/terminal-dispatch-ledger-codec.js +399 -0
- package/dist/src/terminal-dispatch-ledger-codec.js.map +1 -0
- package/dist/src/terminal-dispatch-policy.d.ts +93 -0
- package/dist/src/terminal-dispatch-policy.js +122 -0
- package/dist/src/terminal-dispatch-policy.js.map +1 -0
- package/dist/src/terminal-dispatch-presenter.d.ts +65 -0
- package/dist/src/terminal-dispatch-presenter.js +258 -0
- package/dist/src/terminal-dispatch-presenter.js.map +1 -0
- package/dist/src/terminal-dispatch-receipt.d.ts +79 -0
- package/dist/src/terminal-dispatch-receipt.js +314 -0
- package/dist/src/terminal-dispatch-receipt.js.map +1 -0
- package/dist/src/terminal-dispatch-recovery-cli-adapter.d.ts +132 -0
- package/dist/src/terminal-dispatch-recovery-cli-adapter.js +1330 -0
- package/dist/src/terminal-dispatch-recovery-cli-adapter.js.map +1 -0
- package/dist/src/terminal-dispatch-recovery-service.d.ts +271 -0
- package/dist/src/terminal-dispatch-recovery-service.js +374 -0
- package/dist/src/terminal-dispatch-recovery-service.js.map +1 -0
- package/dist/src/terminal-dispatch-repository-cli-adapter.d.ts +35 -0
- package/dist/src/terminal-dispatch-repository-cli-adapter.js +483 -0
- package/dist/src/terminal-dispatch-repository-cli-adapter.js.map +1 -0
- package/dist/src/terminal-handoff-application-service.d.ts +7 -0
- package/dist/src/terminal-handoff-application-service.js +18 -0
- package/dist/src/terminal-handoff-application-service.js.map +1 -0
- package/dist/src/terminal-handoff-cli-adapter.d.ts +229 -0
- package/dist/src/terminal-handoff-cli-adapter.js +1389 -0
- package/dist/src/terminal-handoff-cli-adapter.js.map +1 -0
- package/dist/src/terminal-handoff-facts.d.ts +12 -0
- package/dist/src/terminal-handoff-facts.js +16 -0
- package/dist/src/terminal-handoff-facts.js.map +1 -0
- package/dist/src/terminal-identity-authority-cli-adapter.d.ts +318 -0
- package/dist/src/terminal-identity-authority-cli-adapter.js +1072 -0
- package/dist/src/terminal-identity-authority-cli-adapter.js.map +1 -0
- package/dist/src/terminal-identity-authority-service.d.ts +48 -0
- package/dist/src/terminal-identity-authority-service.js +45 -0
- package/dist/src/terminal-identity-authority-service.js.map +1 -0
- package/dist/src/terminal-list-cli-adapter.d.ts +274 -0
- package/dist/src/terminal-list-cli-adapter.js +2444 -0
- package/dist/src/terminal-list-cli-adapter.js.map +1 -0
- package/dist/src/terminal-list-renderer.d.ts +34 -0
- package/dist/src/terminal-list-renderer.js +643 -0
- package/dist/src/terminal-list-renderer.js.map +1 -0
- package/dist/src/terminal-maintenance-cli-adapter.d.ts +102 -0
- package/dist/src/terminal-maintenance-cli-adapter.js +1059 -0
- package/dist/src/terminal-maintenance-cli-adapter.js.map +1 -0
- package/dist/src/terminal-monitor-application-service.d.ts +275 -0
- package/dist/src/terminal-monitor-application-service.js +982 -0
- package/dist/src/terminal-monitor-application-service.js.map +1 -0
- package/dist/src/terminal-monitor-cli-adapter.d.ts +130 -0
- package/dist/src/terminal-monitor-cli-adapter.js +442 -0
- package/dist/src/terminal-monitor-cli-adapter.js.map +1 -0
- package/dist/src/terminal-monitor-decision-policy.d.ts +98 -0
- package/dist/src/terminal-monitor-decision-policy.js +246 -0
- package/dist/src/terminal-monitor-decision-policy.js.map +1 -0
- package/dist/src/terminal-monitor-launch-plan.d.ts +45 -0
- package/dist/src/terminal-monitor-launch-plan.js +94 -0
- package/dist/src/terminal-monitor-launch-plan.js.map +1 -0
- package/dist/src/terminal-monitor-ownership-policy.d.ts +31 -0
- package/dist/src/terminal-monitor-ownership-policy.js +64 -0
- package/dist/src/terminal-monitor-ownership-policy.js.map +1 -0
- package/dist/src/terminal-monitor-poll-policy.d.ts +48 -0
- package/dist/src/terminal-monitor-poll-policy.js +67 -0
- package/dist/src/terminal-monitor-poll-policy.js.map +1 -0
- package/dist/src/terminal-monitor-reconciliation-eligibility.d.ts +53 -0
- package/dist/src/terminal-monitor-reconciliation-eligibility.js +114 -0
- package/dist/src/terminal-monitor-reconciliation-eligibility.js.map +1 -0
- package/dist/src/terminal-monitor-state-cli-adapter.d.ts +106 -0
- package/dist/src/terminal-monitor-state-cli-adapter.js +1492 -0
- package/dist/src/terminal-monitor-state-cli-adapter.js.map +1 -0
- package/dist/src/terminal-monitor-state-reconciliation-service.d.ts +87 -0
- package/dist/src/terminal-monitor-state-reconciliation-service.js +106 -0
- package/dist/src/terminal-monitor-state-reconciliation-service.js.map +1 -0
- package/dist/src/terminal-monitor-supervision-cli-adapter.d.ts +122 -0
- package/dist/src/terminal-monitor-supervision-cli-adapter.js +685 -0
- package/dist/src/terminal-monitor-supervision-cli-adapter.js.map +1 -0
- package/dist/src/terminal-process-facts.d.ts +2 -0
- package/dist/src/terminal-process-facts.js +19 -0
- package/dist/src/terminal-process-facts.js.map +1 -0
- package/dist/src/terminal-process-source.d.ts +6 -4
- package/dist/src/terminal-process-source.js +25 -20
- package/dist/src/terminal-process-source.js.map +1 -1
- package/dist/src/terminal-runtime-cli-adapter.d.ts +80 -0
- package/dist/src/terminal-runtime-cli-adapter.js +488 -0
- package/dist/src/terminal-runtime-cli-adapter.js.map +1 -0
- package/dist/src/terminal-scoped-approval-authority.d.ts +62 -0
- package/dist/src/terminal-scoped-approval-authority.js +281 -0
- package/dist/src/terminal-scoped-approval-authority.js.map +1 -0
- package/dist/src/terminal-selector-projection-service.d.ts +26 -0
- package/dist/src/terminal-selector-projection-service.js +81 -0
- package/dist/src/terminal-selector-projection-service.js.map +1 -0
- package/dist/src/terminal-status-cli-adapter.d.ts +126 -0
- package/dist/src/terminal-status-cli-adapter.js +577 -0
- package/dist/src/terminal-status-cli-adapter.js.map +1 -0
- package/dist/src/terminal-status-facts.d.ts +56 -0
- package/dist/src/terminal-status-facts.js +199 -0
- package/dist/src/terminal-status-facts.js.map +1 -0
- package/dist/src/terminal-submission-acceptance.d.ts +62 -145
- package/dist/src/terminal-submission-acceptance.js +555 -222
- package/dist/src/terminal-submission-acceptance.js.map +1 -1
- package/dist/src/terminal-submission-facts.d.ts +123 -0
- package/dist/src/terminal-submission-facts.js +205 -0
- package/dist/src/terminal-submission-facts.js.map +1 -0
- package/dist/src/terminal-turn-binding-authority-cli-adapter.d.ts +14 -0
- package/dist/src/terminal-turn-binding-authority-cli-adapter.js +90 -0
- package/dist/src/terminal-turn-binding-authority-cli-adapter.js.map +1 -0
- package/dist/src/terminal-watch-callback-cli-adapter.d.ts +20 -0
- package/dist/src/terminal-watch-callback-cli-adapter.js +55 -0
- package/dist/src/terminal-watch-callback-cli-adapter.js.map +1 -0
- package/dist/src/terminal-watch-cli-adapter.d.ts +64 -0
- package/dist/src/terminal-watch-cli-adapter.js +508 -0
- package/dist/src/terminal-watch-cli-adapter.js.map +1 -0
- package/dist/src/terminal-watch-service.d.ts +97 -0
- package/dist/src/terminal-watch-service.js +714 -0
- package/dist/src/terminal-watch-service.js.map +1 -0
- package/dist/src/terminal-watch-store.d.ts +149 -0
- package/dist/src/terminal-watch-store.js +861 -0
- package/dist/src/terminal-watch-store.js.map +1 -0
- package/dist/src/value-guards.d.ts +4 -0
- package/dist/src/value-guards.js +12 -0
- package/dist/src/value-guards.js.map +1 -0
- package/dist/src/verified-dead-agent-policy.d.ts +192 -0
- package/dist/src/verified-dead-agent-policy.js +262 -0
- package/dist/src/verified-dead-agent-policy.js.map +1 -0
- package/docs/quickstart-herdr.md +8 -0
- package/docs/quickstart-tmux.md +33 -6
- package/openclaw.plugin.json +11 -3
- package/package.json +3 -1
- package/templates/openclaw-skills/agent-knock-knock/SKILL.md +58 -40
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-turn-recovery-service.js","sourceRoot":"","sources":["../../src/managed-turn-recovery-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AA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SAAS,CAAC;YAC1C,QAAQ,CAAC,WAAW,KAAK,KAAK,CAAC,iBAAiB;YAChD,QAAQ,CAAC,YAAY,KAAK,KAAK,CAAC,kBAAkB;YAClD,CAAC,uBAAuB,CAAC,QAAQ,CAAC,OAAO,CAAC;YAC1C,CAAC,kBAAkB,IAAI,QAAQ,CAAC,SAAS,KAAK,kBAAkB,CAAC;YACjE,CAAC,KAAK,CAAC,kBAAkB;gBACvB,CAAC,mBAAmB,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC5D,CAAC,OAAO,CAAC,cAAc;gBACrB,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,EAC1D,CAAC;YACD,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,+BAA+B,CAC7B,KAA+C,EAC/C,QAAgC;QAEhC,IACE,KAAK,EAAE,cAAc,KAAK,QAAQ,CAAC,SAAS;YAC5C,KAAK,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW;YAC1C,KAAK,CAAC,YAAY,KAAK,QAAQ,CAAC,YAAY;YAC5C,CAAC,mBAAmB,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,EACrD,CAAC;YACD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
type Awaitable<Value> = Value | PromiseLike<Value>;
|
|
2
|
+
type ScopeKind = "terminal" | "storeWriter" | "state";
|
|
3
|
+
export type CanonicalMutationResource<Value = unknown> = Readonly<{
|
|
4
|
+
key: string;
|
|
5
|
+
value: Value;
|
|
6
|
+
}>;
|
|
7
|
+
type ScopeResources = Readonly<Record<ScopeKind, CanonicalMutationResource>>;
|
|
8
|
+
export type CanonicalMutationResources = Readonly<Pick<ScopeResources, "terminal" | "storeWriter"> & Partial<ScopeResources>>;
|
|
9
|
+
export type CanonicalStateMutationResources = Readonly<ScopeResources>;
|
|
10
|
+
declare const mutationScopeBrand: unique symbol;
|
|
11
|
+
type MutationScope<Kind extends ScopeKind> = Readonly<{
|
|
12
|
+
[mutationScopeBrand]: Kind;
|
|
13
|
+
}>;
|
|
14
|
+
export type CanonicalMutationScopes = Readonly<{
|
|
15
|
+
terminal: MutationScope<"terminal">;
|
|
16
|
+
storeWriter: MutationScope<"storeWriter">;
|
|
17
|
+
state?: MutationScope<"state">;
|
|
18
|
+
}>;
|
|
19
|
+
export type CanonicalStateMutationScopes = CanonicalMutationScopes & Readonly<{
|
|
20
|
+
state: MutationScope<"state">;
|
|
21
|
+
}>;
|
|
22
|
+
export type CanonicalMutationLockPorts = Readonly<{
|
|
23
|
+
resources: CanonicalMutationResources;
|
|
24
|
+
acquireTerminal: () => Awaitable<() => void>;
|
|
25
|
+
withStoreWriter: <Result>(operation: () => Promise<Result>) => Promise<Result>;
|
|
26
|
+
acquireState?: () => Awaitable<() => void>;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function canonicalMutationResource<Value>(key: string, value: Value): Readonly<{
|
|
29
|
+
key: string;
|
|
30
|
+
value: Value;
|
|
31
|
+
}>;
|
|
32
|
+
type ScopesFor<Kinds extends readonly ScopeKind[]> = Pick<CanonicalStateMutationScopes, Kinds[number]>;
|
|
33
|
+
export declare function capabilityGatedRepositoryOperation<const Required extends readonly ScopeKind[], Bound extends Required[number], Resource, Args extends unknown[], Result>(required: Required, bound: Bound, operation: (resource: Resource, ...args: Args) => Result): (scopes: ScopesFor<Required>, resources: Pick<ScopeResources, Required[number]>, ...args: Args) => Result;
|
|
34
|
+
export declare function capabilityGatedRepositoryPairOperation<const Required extends readonly ScopeKind[], First extends Required[number], Second extends Required[number], FirstResource, SecondResource, Args extends unknown[], Result>(required: Required, bound: readonly [First, Second], operation: (first: FirstResource, second: SecondResource, ...args: Args) => Result): (scopes: ScopesFor<Required>, resources: Pick<ScopeResources, Required[number]>, ...args: Args) => Result;
|
|
35
|
+
type ScopesForPorts<Ports> = Ports extends {
|
|
36
|
+
acquireState: () => unknown;
|
|
37
|
+
} ? CanonicalStateMutationScopes : CanonicalMutationScopes;
|
|
38
|
+
type ResourcesForPorts<Ports> = Ports extends {
|
|
39
|
+
acquireState: () => unknown;
|
|
40
|
+
} ? ScopeResources : CanonicalMutationResources;
|
|
41
|
+
/** Acquire terminal -> writer -> optional state and release in reverse. */
|
|
42
|
+
export declare function withCanonicalMutationLocks<Result, Ports extends CanonicalMutationLockPorts>(ports: Ports, operation: (scopes: ScopesForPorts<Ports>, resources: ResourcesForPorts<Ports>) => Promise<Result>): Promise<Result>;
|
|
43
|
+
/** Add one state scope to the currently active terminal + writer transaction. */
|
|
44
|
+
export declare function withCanonicalStateMutationLock<Result, StateResource>(scopes: CanonicalMutationScopes, resources: CanonicalMutationResources, state: Readonly<{
|
|
45
|
+
resource: CanonicalMutationResource<StateResource>;
|
|
46
|
+
acquire: () => Awaitable<() => void>;
|
|
47
|
+
}>, operation: (scopes: CanonicalStateMutationScopes, resources: CanonicalStateMutationResources) => Promise<Result>): Promise<Result>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const scopeRecords = new WeakMap();
|
|
2
|
+
export function canonicalMutationResource(key, value) { return Object.freeze({ key, value }); }
|
|
3
|
+
function createScope(transaction, kind, resource) {
|
|
4
|
+
const scope = Object.freeze({});
|
|
5
|
+
scopeRecords.set(scope, { kind, transaction, resource });
|
|
6
|
+
return scope;
|
|
7
|
+
}
|
|
8
|
+
function expireScope(scope) { scopeRecords.delete(scope); }
|
|
9
|
+
async function withAcquiredScope(transaction, kind, resource, acquire, operation) {
|
|
10
|
+
const release = await acquire();
|
|
11
|
+
const scope = createScope(transaction, kind, resource);
|
|
12
|
+
try {
|
|
13
|
+
return await operation(scope);
|
|
14
|
+
}
|
|
15
|
+
finally {
|
|
16
|
+
expireScope(scope);
|
|
17
|
+
release();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function assertActiveScopes(scopes, resources, required) {
|
|
21
|
+
let transaction;
|
|
22
|
+
for (const kind of required) {
|
|
23
|
+
const record = scopes[kind] && scopeRecords.get(scopes[kind]);
|
|
24
|
+
if (!record || record.kind !== kind || record.resource !== resources[kind]) {
|
|
25
|
+
throw new Error(`mutation repository requires active authentic ${kind} scope`);
|
|
26
|
+
}
|
|
27
|
+
if (transaction && transaction !== record.transaction) {
|
|
28
|
+
throw new Error("mutation repository scopes belong to different transactions");
|
|
29
|
+
}
|
|
30
|
+
transaction = record.transaction;
|
|
31
|
+
}
|
|
32
|
+
if (!transaction) {
|
|
33
|
+
throw new Error("mutation repository requires at least one active scope");
|
|
34
|
+
}
|
|
35
|
+
return transaction;
|
|
36
|
+
}
|
|
37
|
+
export function capabilityGatedRepositoryOperation(required, bound, operation) {
|
|
38
|
+
return (scopes, resources, ...args) => {
|
|
39
|
+
assertActiveScopes(scopes, resources, required);
|
|
40
|
+
return operation(resources[bound].value, ...args);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function capabilityGatedRepositoryPairOperation(required, bound, operation) {
|
|
44
|
+
return (scopes, resources, ...args) => {
|
|
45
|
+
assertActiveScopes(scopes, resources, required);
|
|
46
|
+
return operation(resources[bound[0]].value, resources[bound[1]].value, ...args);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Acquire terminal -> writer -> optional state and release in reverse. */
|
|
50
|
+
export async function withCanonicalMutationLocks(ports, operation) {
|
|
51
|
+
const transaction = {};
|
|
52
|
+
return withAcquiredScope(transaction, "terminal", ports.resources.terminal, ports.acquireTerminal, (terminal) => ports.withStoreWriter(async () => {
|
|
53
|
+
const storeWriter = createScope(transaction, "storeWriter", ports.resources.storeWriter);
|
|
54
|
+
const invoke = (state) => operation({ terminal, storeWriter, ...(state ? { state } : {}) }, ports.resources);
|
|
55
|
+
try {
|
|
56
|
+
if (!ports.acquireState)
|
|
57
|
+
return await invoke();
|
|
58
|
+
const stateResource = ports.resources.state;
|
|
59
|
+
if (!stateResource)
|
|
60
|
+
throw new Error("state mutation lock requires a canonical resource");
|
|
61
|
+
return await withAcquiredScope(transaction, "state", stateResource, ports.acquireState, invoke);
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
expireScope(storeWriter);
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
/** Add one state scope to the currently active terminal + writer transaction. */
|
|
69
|
+
export async function withCanonicalStateMutationLock(scopes, resources, state, operation) {
|
|
70
|
+
const transaction = assertActiveScopes(scopes, resources, ["terminal", "storeWriter"]);
|
|
71
|
+
return withAcquiredScope(transaction, "state", state.resource, state.acquire, (stateScope) => operation({ ...scopes, state: stateScope }, Object.freeze({ ...resources, state: state.resource })));
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=mutation-transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-transaction.js","sourceRoot":"","sources":["../../src/mutation-transaction.ts"],"names":[],"mappings":"AAmBA,MAAM,YAAY,GAAG,IAAI,OAAO,EAAmG,CAAC;AACpI,MAAM,UAAU,yBAAyB,CAAQ,GAAW,EAAE,KAAY,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACrH,SAAS,WAAW,CAAyB,WAAmB,EAAE,IAAU,EAAE,QAAmC;IAC/G,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAwB,CAAC;IACvD,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC;AACf,CAAC;AACD,SAAS,WAAW,CAAC,KAA+B,IAAU,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAA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AAC,EAAE,CAAC,EAA2B,EAAE,KAAK,CAAC,SAAqC,CAC7H,CAAC;QACF,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,YAAY;gBAAE,OAAO,MAAM,MAAM,EAAE,CAAC;YAC/C,MAAM,aAAa,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;YAC5C,IAAI,CAAC,aAAa;gBAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACzF,OAAO,MAAM,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAClG,CAAC;gBAAS,CAAC;YAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAAC,CAAC;IACzC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,MAA+B,EAC/B,SAAqC,EACrC,KAGE,EACF,SAGoB;IAEpB,MAAM,WAAW,GAAG,kBAAkB,CACpC,MAAM,EACN,SAAS,EACT,CAAC,UAAU,EAAE,aAAa,CAAC,CAC5B,CAAC;IACF,OAAO,iBAAiB,CACtB,WAAW,EACX,OAAO,EACP,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,OAAO,EACb,CAAC,UAAU,EAAE,EAAE,CAAC,SAAS,CACvB,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,EAChC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,CACpB,CAClC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { ExecutorKind } from "./executors.js";
|
|
2
|
+
import type { FileLockAcquisitionOptions } from "./file-lock-cli-adapter.js";
|
|
3
|
+
import { type ManagedSessionState } from "./managed-session.js";
|
|
4
|
+
import { type LifecycleTerminalObservation, type NativeThreadLifecycleQueryPorts } from "./native-thread-lifecycle-query-service.js";
|
|
5
|
+
import { type Conversation } from "./protocol.js";
|
|
6
|
+
import type { TerminalAgentAdapter, TerminalControlRef, TerminalRuntimeIdentity, TerminalThreadLifecycleCapabilities } from "./terminal-agent-adapter.js";
|
|
7
|
+
import { type ResolvedTerminalConversation } from "./terminal-agent-bridge.js";
|
|
8
|
+
import { type CodexAllowedCompanionSet } from "./terminal-authority-policy.js";
|
|
9
|
+
import type { TerminalNativeIdentity } from "./terminal-binding-authority.js";
|
|
10
|
+
import type { TerminalDispatchLedgerDocument } from "./terminal-dispatch-ledger-codec.js";
|
|
11
|
+
import type { TerminalRuntimeCliAdapter } from "./terminal-runtime-cli-adapter.js";
|
|
12
|
+
export type NativeLifecycleCliOptions = Readonly<Record<string, unknown>>;
|
|
13
|
+
export interface NativeLifecycleSnapshot {
|
|
14
|
+
readonly identity?: TerminalNativeIdentity;
|
|
15
|
+
readonly runtimeIdentity?: TerminalNativeIdentity;
|
|
16
|
+
readonly codexCompanions: CodexAllowedCompanionSet;
|
|
17
|
+
readonly session?: ManagedSessionState;
|
|
18
|
+
readonly version?: string;
|
|
19
|
+
readonly capabilities: TerminalThreadLifecycleCapabilities;
|
|
20
|
+
readonly bindingToken: string;
|
|
21
|
+
readonly bindingTokens: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
interface NativeLifecycleIdentityPorts {
|
|
24
|
+
resolveCurrent(input: {
|
|
25
|
+
options: NativeLifecycleCliOptions;
|
|
26
|
+
agent: ExecutorKind;
|
|
27
|
+
pid: number;
|
|
28
|
+
cwd?: string;
|
|
29
|
+
preferredSessionId?: string;
|
|
30
|
+
allowedCompanionIdentity?: CodexAllowedCompanionSet["primary"];
|
|
31
|
+
allowedAdditionalIdentities?: readonly NonNullable<CodexAllowedCompanionSet["primary"]>[];
|
|
32
|
+
}): Promise<TerminalNativeIdentity | undefined>;
|
|
33
|
+
managedContext(input: {
|
|
34
|
+
storeDir: string;
|
|
35
|
+
terminal: ResolvedTerminalConversation;
|
|
36
|
+
}): {
|
|
37
|
+
preferredSessionId?: string;
|
|
38
|
+
companions: CodexAllowedCompanionSet;
|
|
39
|
+
};
|
|
40
|
+
boundSession(input: {
|
|
41
|
+
storeDir: string;
|
|
42
|
+
terminal: ResolvedTerminalConversation;
|
|
43
|
+
identity?: TerminalNativeIdentity;
|
|
44
|
+
}): ManagedSessionState | undefined;
|
|
45
|
+
materializeSession(input: {
|
|
46
|
+
options: NativeLifecycleCliOptions;
|
|
47
|
+
terminal: ResolvedTerminalConversation;
|
|
48
|
+
identity?: TerminalNativeIdentity;
|
|
49
|
+
}): ManagedSessionState | undefined;
|
|
50
|
+
refineSession(input: {
|
|
51
|
+
storeDir: string;
|
|
52
|
+
session: ManagedSessionState;
|
|
53
|
+
terminalControl: TerminalControlRef;
|
|
54
|
+
identity?: TerminalNativeIdentity;
|
|
55
|
+
}): ManagedSessionState;
|
|
56
|
+
logicalIdentity(input: {
|
|
57
|
+
storeDir: string;
|
|
58
|
+
session: ManagedSessionState;
|
|
59
|
+
observedIdentity?: TerminalNativeIdentity;
|
|
60
|
+
}): TerminalNativeIdentity | undefined;
|
|
61
|
+
companionSet(input: {
|
|
62
|
+
storeDir: string;
|
|
63
|
+
session: ManagedSessionState;
|
|
64
|
+
}): CodexAllowedCompanionSet;
|
|
65
|
+
processIncarnation(pid: number): {
|
|
66
|
+
processUuid: string;
|
|
67
|
+
processBirth: string;
|
|
68
|
+
};
|
|
69
|
+
runtimeForLiveIdentity(input: {
|
|
70
|
+
terminal: ResolvedTerminalConversation;
|
|
71
|
+
identity?: TerminalNativeIdentity;
|
|
72
|
+
expectedEmptyNativeSession?: boolean;
|
|
73
|
+
physicalOnly?: boolean;
|
|
74
|
+
}): TerminalRuntimeIdentity;
|
|
75
|
+
ownerIsInactive(input: {
|
|
76
|
+
session: ManagedSessionState;
|
|
77
|
+
terminal: LifecycleTerminalObservation;
|
|
78
|
+
identity?: TerminalNativeIdentity;
|
|
79
|
+
}): boolean;
|
|
80
|
+
assertCodexComposerReady(input: {
|
|
81
|
+
options: NativeLifecycleCliOptions;
|
|
82
|
+
terminalControl: TerminalControlRef;
|
|
83
|
+
}): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
interface NativeLifecycleStatePorts {
|
|
86
|
+
storeDir(options: NativeLifecycleCliOptions): string;
|
|
87
|
+
inspectStore(storeDir: string): {
|
|
88
|
+
writable: boolean;
|
|
89
|
+
};
|
|
90
|
+
runtimeDir(): string;
|
|
91
|
+
acquireTerminal(storeDir: string, terminalControl: TerminalControlRef, options?: FileLockAcquisitionOptions): () => void;
|
|
92
|
+
loadLedger(terminalControl: TerminalControlRef): TerminalDispatchLedgerDocument | undefined;
|
|
93
|
+
managedTurns(storeDir: string, sessionId: string): readonly Conversation[];
|
|
94
|
+
terminalBlockingTurns(storeDir: string, terminalControl: TerminalControlRef): readonly Conversation[];
|
|
95
|
+
hasUnresolvedTransition(storeDir: string, session: ManagedSessionState): boolean;
|
|
96
|
+
dispatchOwnership(terminalControl: TerminalControlRef): {
|
|
97
|
+
state: string;
|
|
98
|
+
};
|
|
99
|
+
assertNativeThreadStoreAuthority(input: {
|
|
100
|
+
terminalControl: TerminalControlRef;
|
|
101
|
+
nativeThreadId: string;
|
|
102
|
+
storeDir: string;
|
|
103
|
+
}): void;
|
|
104
|
+
orphanedForRecovery(terminalControl: TerminalControlRef): TerminalDispatchLedgerDocument | undefined;
|
|
105
|
+
}
|
|
106
|
+
export interface CreateNativeThreadLifecycleCliAdapterInput {
|
|
107
|
+
runtime: {
|
|
108
|
+
forOptions(options: NativeLifecycleCliOptions): TerminalRuntimeCliAdapter;
|
|
109
|
+
sleep(milliseconds: number): Promise<void>;
|
|
110
|
+
};
|
|
111
|
+
identity: NativeLifecycleIdentityPorts;
|
|
112
|
+
state: NativeLifecycleStatePorts;
|
|
113
|
+
output: {
|
|
114
|
+
cwd(): string;
|
|
115
|
+
print(value: unknown): void;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export interface NativeThreadOwnershipRequest {
|
|
119
|
+
options: NativeLifecycleCliOptions;
|
|
120
|
+
agent: ExecutorKind;
|
|
121
|
+
currentPid: number;
|
|
122
|
+
nativeThreadId: string;
|
|
123
|
+
storeDir: string;
|
|
124
|
+
terminalControl: TerminalControlRef;
|
|
125
|
+
excludedManagedSessionId?: string;
|
|
126
|
+
allowedManagedSessionIds?: string[];
|
|
127
|
+
}
|
|
128
|
+
export interface NativeThreadLifecycleCliFacade {
|
|
129
|
+
resolveLifecycleTerminal(options: NativeLifecycleCliOptions): Promise<ResolvedTerminalConversation>;
|
|
130
|
+
queryPorts(options: NativeLifecycleCliOptions): NativeThreadLifecycleQueryPorts;
|
|
131
|
+
assertExclusive(input: NativeThreadOwnershipRequest): Promise<void>;
|
|
132
|
+
currentSnapshot(options: NativeLifecycleCliOptions, terminal: ResolvedTerminalConversation, settings?: {
|
|
133
|
+
materialize?: boolean;
|
|
134
|
+
}): Promise<NativeLifecycleSnapshot>;
|
|
135
|
+
lifecycleBindingTokens(input: {
|
|
136
|
+
session?: ManagedSessionState;
|
|
137
|
+
terminal: ResolvedTerminalConversation;
|
|
138
|
+
identity?: TerminalNativeIdentity;
|
|
139
|
+
}): readonly string[];
|
|
140
|
+
agentAdapter(options: NativeLifecycleCliOptions, agent: ExecutorKind): TerminalAgentAdapter;
|
|
141
|
+
runList(options: NativeLifecycleCliOptions): Promise<void>;
|
|
142
|
+
runInspect(options: NativeLifecycleCliOptions): Promise<void>;
|
|
143
|
+
assertSameInspectionTerminal(expected: ResolvedTerminalConversation, actual: ResolvedTerminalConversation, stage: string): void;
|
|
144
|
+
codexLatentClearResumeObservation(input: {
|
|
145
|
+
screen?: string;
|
|
146
|
+
agentVersion?: string;
|
|
147
|
+
}): {
|
|
148
|
+
sourceNativeThreadId: string;
|
|
149
|
+
fingerprint: string;
|
|
150
|
+
} | undefined;
|
|
151
|
+
nativeInspectionComposerEmpty(agent: ExecutorKind, screen?: string): boolean;
|
|
152
|
+
}
|
|
153
|
+
export declare function createNativeThreadLifecycleCliAdapter(ports: CreateNativeThreadLifecycleCliAdapterInput): NativeThreadLifecycleCliFacade;
|
|
154
|
+
export {};
|