shennian 0.5.0 → 0.5.2
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/publish-build-manifest.json +165 -125
- package/dist/src/agents/acp/adapter.js +2 -2
- package/dist/src/agents/acp/capability-cache.js +2 -2
- package/dist/src/agents/acp/catalog.js +2 -2
- package/dist/src/agents/acp/manifests.js +2 -2
- package/dist/src/agents/claude.js +8 -6
- package/dist/src/agents/codex.js +2 -2
- package/dist/src/agents/command-spec.js +4 -4
- package/dist/src/agents/cursor.js +1 -1
- package/dist/src/agents/custom-recovery-conformance.js +2 -2
- package/dist/src/agents/gemini.js +1 -1
- package/dist/src/agents/model-registry/discovery.js +3 -3
- package/dist/src/agents/model-registry/service.js +1 -1
- package/dist/src/agents/model-registry.js +1 -1
- package/dist/src/agents/openclaw.js +2 -2
- package/dist/src/agents/opencode.js +1 -1
- package/dist/src/agents/pi-coding-agent.js +3 -4
- package/dist/src/agents/pi-session-ownership.js +2 -2
- package/dist/src/agents/spawn-errors.js +1 -0
- package/dist/src/agents/windows-agent-paths.js +1 -0
- package/dist/src/commands/agent-readiness.js +2 -2
- package/dist/src/commands/daemon-service-spec.js +1 -1
- package/dist/src/commands/daemon.js +6 -6
- package/dist/src/commands/queue.js +1 -0
- package/dist/src/commands/room.js +3 -3
- package/dist/src/config/index.js +2 -2
- package/dist/src/fs/atomic-rename.js +1 -0
- package/dist/src/index.js +3 -3
- package/dist/src/native-fusion/claude-entry-parser.js +7 -0
- package/dist/src/native-fusion/local-repository.js +2 -2
- package/dist/src/native-fusion/native-source-deletions.js +2 -2
- package/dist/src/native-fusion/parsers.js +1 -3
- package/dist/src/native-fusion/state.js +2 -2
- package/dist/src/personal-sync/epoch.js +2 -2
- package/dist/src/personal-sync/identity.js +2 -2
- package/dist/src/relay/client.js +1 -1
- package/dist/src/room/activation-service.js +6 -6
- package/dist/src/room/attachment-cache.js +2 -2
- package/dist/src/room/host-session-observations.js +2 -2
- package/dist/src/room/managed-context.js +1 -1
- package/dist/src/room/managed-room-ipc.js +2 -2
- package/dist/src/room/mirror-sync-service.js +1 -1
- package/dist/src/room/public-attachment-cache.js +2 -2
- package/dist/src/room/room-error-guidance.js +1 -0
- package/dist/src/room/session-registry.js +2 -2
- package/dist/src/security/managed-agent-policy.js +1 -1
- package/dist/src/security/managed-agent-runtime.js +1 -1
- package/dist/src/session/attachment-transfer-store.js +2 -2
- package/dist/src/session/canonical-store.js +5 -5
- package/dist/src/session/deletion-sync-state.js +2 -2
- package/dist/src/session/handlers/agent-workspace-validation.js +1 -1
- package/dist/src/session/handlers/chat-adapter-config.js +1 -1
- package/dist/src/session/handlers/chat-events.js +2 -2
- package/dist/src/session/handlers/chat-recovery.js +1 -1
- package/dist/src/session/handlers/chat.js +1 -1
- package/dist/src/session/manager.js +1 -1
- package/dist/src/session/native-cleanup-outbox.js +2 -2
- package/dist/src/session/queue-diagnostics.js +1 -0
- package/dist/src/session/queue-dispatch-failure.js +1 -0
- package/dist/src/session/queue-helpers.js +5 -5
- package/dist/src/session/queue-retry.js +1 -1
- package/dist/src/session/queue-storage.js +2 -2
- package/dist/src/session/queue.js +1 -1
- package/dist/src/session/room-reply-notice.js +1 -0
- package/dist/src/session/run-recovery/journal.js +2 -2
- package/dist/src/session/run-stall.js +1 -0
- package/dist/src/session/store.js +2 -2
- package/dist/src/session/tool-detail-store.js +2 -2
- package/node_modules/@shennian/wire/dist/agent-capabilities.js +1 -1
- package/node_modules/@shennian/wire/dist/agent-workspace.js +1 -144
- package/node_modules/@shennian/wire/dist/envelope.js +1 -1
- package/node_modules/@shennian/wire/dist/events.js +1 -1
- package/node_modules/@shennian/wire/dist/external-message-format.js +3 -70
- package/node_modules/@shennian/wire/dist/frames.js +1 -1
- package/node_modules/@shennian/wire/dist/fs.js +2 -7
- package/node_modules/@shennian/wire/dist/index.js +1 -21
- package/node_modules/@shennian/wire/dist/machine.js +1 -1
- package/node_modules/@shennian/wire/dist/message-payload.js +8 -307
- package/node_modules/@shennian/wire/dist/methods.js +1 -3
- package/node_modules/@shennian/wire/dist/native-session.js +1 -1
- package/node_modules/@shennian/wire/dist/project-fs.js +1 -462
- package/node_modules/@shennian/wire/dist/project-path.js +1 -25
- package/node_modules/@shennian/wire/dist/project.js +1 -3
- package/node_modules/@shennian/wire/dist/relay-connectivity.js +1 -29
- package/node_modules/@shennian/wire/dist/room.js +1 -20
- package/node_modules/@shennian/wire/dist/schedule.js +1 -1
- package/node_modules/@shennian/wire/dist/session-sync.js +1 -123
- package/node_modules/@shennian/wire/dist/session.js +1 -60
- package/node_modules/@shennian/wire/dist/tool-detail.js +1 -9
- package/node_modules/@shennian/wire/dist/voice-chief.js +1 -3
- package/package.json +3 -8
- package/dist/bin/shennian.d.ts +0 -2
- package/dist/src/agent-env.d.ts +0 -44
- package/dist/src/agents/acp/adapter.d.ts +0 -82
- package/dist/src/agents/acp/auth-state.d.ts +0 -3
- package/dist/src/agents/acp/auth.d.ts +0 -7
- package/dist/src/agents/acp/capability-cache.d.ts +0 -14
- package/dist/src/agents/acp/catalog.d.ts +0 -11
- package/dist/src/agents/acp/client-services.d.ts +0 -37
- package/dist/src/agents/acp/discovery.d.ts +0 -10
- package/dist/src/agents/acp/events.d.ts +0 -4
- package/dist/src/agents/acp/manifests.d.ts +0 -63
- package/dist/src/agents/acp/metrics.d.ts +0 -24
- package/dist/src/agents/acp/package-commands.d.ts +0 -4
- package/dist/src/agents/acp/process-client.d.ts +0 -41
- package/dist/src/agents/acp/process-tree.d.ts +0 -2
- package/dist/src/agents/acp/types.d.ts +0 -31
- package/dist/src/agents/acp/watcher.d.ts +0 -22
- package/dist/src/agents/adapter.d.ts +0 -180
- package/dist/src/agents/auth-status.d.ts +0 -4
- package/dist/src/agents/claude-managed-permissions.d.ts +0 -33
- package/dist/src/agents/claude.d.ts +0 -69
- package/dist/src/agents/codex-managed-permissions.d.ts +0 -32
- package/dist/src/agents/codex-managed-room-tools.d.ts +0 -41
- package/dist/src/agents/codex-protocol.d.ts +0 -103
- package/dist/src/agents/codex-runtime.d.ts +0 -91
- package/dist/src/agents/codex-utils.d.ts +0 -29
- package/dist/src/agents/codex.d.ts +0 -59
- package/dist/src/agents/command-spec.d.ts +0 -55
- package/dist/src/agents/config-status.d.ts +0 -18
- package/dist/src/agents/cursor-managed-permissions.d.ts +0 -28
- package/dist/src/agents/cursor.d.ts +0 -44
- package/dist/src/agents/custom-managed-runtime.d.ts +0 -37
- package/dist/src/agents/custom-recovery-conformance.d.ts +0 -2
- package/dist/src/agents/custom.d.ts +0 -62
- package/dist/src/agents/detect.d.ts +0 -23
- package/dist/src/agents/event-terminal-gate.d.ts +0 -16
- package/dist/src/agents/external-channel-instructions.d.ts +0 -4
- package/dist/src/agents/gemini.d.ts +0 -32
- package/dist/src/agents/manager.d.ts +0 -57
- package/dist/src/agents/model-registry/cache.d.ts +0 -4
- package/dist/src/agents/model-registry/discovery.d.ts +0 -4
- package/dist/src/agents/model-registry/opencode-api.d.ts +0 -2
- package/dist/src/agents/model-registry/parsers.d.ts +0 -20
- package/dist/src/agents/model-registry/runner.d.ts +0 -6
- package/dist/src/agents/model-registry/service.d.ts +0 -10
- package/dist/src/agents/model-registry/types.d.ts +0 -39
- package/dist/src/agents/model-registry.d.ts +0 -17
- package/dist/src/agents/native-capabilities.d.ts +0 -10
- package/dist/src/agents/openclaw.d.ts +0 -29
- package/dist/src/agents/opencode-managed-permissions.d.ts +0 -25
- package/dist/src/agents/opencode.d.ts +0 -46
- package/dist/src/agents/pi-coding-agent-managed-permissions.d.ts +0 -7
- package/dist/src/agents/pi-coding-agent.d.ts +0 -63
- package/dist/src/agents/pi-managed-extension.d.ts +0 -12
- package/dist/src/agents/pi-managed-model-broker.d.ts +0 -27
- package/dist/src/agents/pi-managed-model-broker.js +0 -1
- package/dist/src/agents/pi-rpc-client.d.ts +0 -31
- package/dist/src/agents/pi-session-ownership.d.ts +0 -2
- package/dist/src/agents/platform-instructions.d.ts +0 -5
- package/dist/src/agents/runtime-compatibility.d.ts +0 -11
- package/dist/src/agents/workbuddy-managed-permissions.d.ts +0 -37
- package/dist/src/agents/workbuddy.d.ts +0 -63
- package/dist/src/commands/agent-readiness.d.ts +0 -17
- package/dist/src/commands/agent.d.ts +0 -2
- package/dist/src/commands/daemon-instance-lock.d.ts +0 -21
- package/dist/src/commands/daemon-process.d.ts +0 -6
- package/dist/src/commands/daemon-service-spec.d.ts +0 -26
- package/dist/src/commands/daemon-start-wait.d.ts +0 -9
- package/dist/src/commands/daemon-state.d.ts +0 -57
- package/dist/src/commands/daemon-windows.d.ts +0 -33
- package/dist/src/commands/daemon.d.ts +0 -67
- package/dist/src/commands/integration.d.ts +0 -3
- package/dist/src/commands/logout.d.ts +0 -3
- package/dist/src/commands/manager.d.ts +0 -2
- package/dist/src/commands/pair-authorization.d.ts +0 -3
- package/dist/src/commands/pair-browser.d.ts +0 -44
- package/dist/src/commands/pair-qr.d.ts +0 -4
- package/dist/src/commands/pair.d.ts +0 -19
- package/dist/src/commands/room.d.ts +0 -16
- package/dist/src/commands/runtime.d.ts +0 -2
- package/dist/src/commands/schedule.d.ts +0 -2
- package/dist/src/commands/tools.d.ts +0 -2
- package/dist/src/commands/upgrade.d.ts +0 -31
- package/dist/src/commands/worker.d.ts +0 -11
- package/dist/src/config/index.d.ts +0 -58
- package/dist/src/daemon-ipc/agent-readiness.d.ts +0 -15
- package/dist/src/daemon-ipc/client.d.ts +0 -8
- package/dist/src/daemon-ipc/control.d.ts +0 -16
- package/dist/src/daemon-ipc/json.d.ts +0 -3
- package/dist/src/daemon-ipc/paths.d.ts +0 -15
- package/dist/src/daemon-ipc/protocol.d.ts +0 -31
- package/dist/src/daemon-ipc/secret.d.ts +0 -3
- package/dist/src/daemon-ipc/server.d.ts +0 -20
- package/dist/src/daemon-log.d.ts +0 -9
- package/dist/src/env-path.d.ts +0 -15
- package/dist/src/fs/boundary.d.ts +0 -23
- package/dist/src/fs/handler.d.ts +0 -26
- package/dist/src/fs/security.d.ts +0 -2
- package/dist/src/fs/text-decoder.d.ts +0 -10
- package/dist/src/index.d.ts +0 -1
- package/dist/src/log-redaction.d.ts +0 -4
- package/dist/src/log-reporter.d.ts +0 -41
- package/dist/src/manager/prompt.d.ts +0 -2
- package/dist/src/manager/registry.d.ts +0 -184
- package/dist/src/manager/retired-external-channel-compat.d.ts +0 -78
- package/dist/src/manager/runtime.d.ts +0 -90
- package/dist/src/manager/worker-ipc.d.ts +0 -28
- package/dist/src/manager/worker-markdown.d.ts +0 -10
- package/dist/src/native-fusion/codex-files.d.ts +0 -10
- package/dist/src/native-fusion/codex-message-parser.d.ts +0 -9
- package/dist/src/native-fusion/codex-parser.d.ts +0 -8
- package/dist/src/native-fusion/codex-user-input.d.ts +0 -11
- package/dist/src/native-fusion/config.d.ts +0 -1
- package/dist/src/native-fusion/file-identity.d.ts +0 -9
- package/dist/src/native-fusion/file-watcher.d.ts +0 -26
- package/dist/src/native-fusion/local-repository.d.ts +0 -90
- package/dist/src/native-fusion/native-source-deletions.d.ts +0 -47
- package/dist/src/native-fusion/opencode-parser.d.ts +0 -29
- package/dist/src/native-fusion/parser-common.d.ts +0 -35
- package/dist/src/native-fusion/parsers.d.ts +0 -13
- package/dist/src/native-fusion/service.d.ts +0 -64
- package/dist/src/native-fusion/session-header.d.ts +0 -13
- package/dist/src/native-fusion/session-native-sources.d.ts +0 -24
- package/dist/src/native-fusion/source-visibility-audit.d.ts +0 -16
- package/dist/src/native-fusion/source-visibility.d.ts +0 -25
- package/dist/src/native-fusion/state.d.ts +0 -4
- package/dist/src/native-fusion/types.d.ts +0 -82
- package/dist/src/personal-sync/epoch.d.ts +0 -17
- package/dist/src/personal-sync/identity.d.ts +0 -1
- package/dist/src/personal-sync/machine-authority.d.ts +0 -12
- package/dist/src/personal-sync/metrics.d.ts +0 -25
- package/dist/src/personal-sync/paths.d.ts +0 -5
- package/dist/src/region.d.ts +0 -15
- package/dist/src/relay/client.d.ts +0 -81
- package/dist/src/room/activation-audit.d.ts +0 -15
- package/dist/src/room/activation-policy.d.ts +0 -8
- package/dist/src/room/activation-service.d.ts +0 -77
- package/dist/src/room/attachment-cache.d.ts +0 -44
- package/dist/src/room/attachment-upload.d.ts +0 -20
- package/dist/src/room/device-authorization-client.d.ts +0 -91
- package/dist/src/room/host-session-observations.d.ts +0 -54
- package/dist/src/room/invite-bootstrap.d.ts +0 -49
- package/dist/src/room/invite-qr.d.ts +0 -6
- package/dist/src/room/live-delivery.d.ts +0 -5
- package/dist/src/room/managed-context.d.ts +0 -49
- package/dist/src/room/managed-prompt-composer.d.ts +0 -47
- package/dist/src/room/managed-room-binding.d.ts +0 -69
- package/dist/src/room/managed-room-ipc.d.ts +0 -65
- package/dist/src/room/mirror-sync-service.d.ts +0 -49
- package/dist/src/room/public-attachment-cache.d.ts +0 -34
- package/dist/src/room/public-room-client.d.ts +0 -37
- package/dist/src/room/registration-authority.d.ts +0 -4
- package/dist/src/room/room-action-client-types.d.ts +0 -137
- package/dist/src/room/room-action-client.d.ts +0 -116
- package/dist/src/room/room-binding-client.d.ts +0 -62
- package/dist/src/room/session-registry.d.ts +0 -158
- package/dist/src/runtime-distribution.d.ts +0 -7
- package/dist/src/schedules/personal-context.d.ts +0 -2
- package/dist/src/schedules/server-client.d.ts +0 -19
- package/dist/src/security/managed-agent-credential-paths.d.ts +0 -6
- package/dist/src/security/managed-agent-executable.d.ts +0 -19
- package/dist/src/security/managed-agent-policy.d.ts +0 -66
- package/dist/src/security/managed-agent-runtime.d.ts +0 -44
- package/dist/src/session/archive-zip.d.ts +0 -10
- package/dist/src/session/attachment-reference.d.ts +0 -2
- package/dist/src/session/attachment-transfer-store.d.ts +0 -45
- package/dist/src/session/canonical-store.d.ts +0 -104
- package/dist/src/session/deletion-sync-state.d.ts +0 -20
- package/dist/src/session/deletion-sync-validation.d.ts +0 -2
- package/dist/src/session/deletion-synchronizer.d.ts +0 -9
- package/dist/src/session/handlers/agent-capabilities.d.ts +0 -3
- package/dist/src/session/handlers/agent-config.d.ts +0 -7
- package/dist/src/session/handlers/agent-control.d.ts +0 -4
- package/dist/src/session/handlers/agent-workspace-validation.d.ts +0 -28
- package/dist/src/session/handlers/agents.d.ts +0 -11
- package/dist/src/session/handlers/chat-adapter-config.d.ts +0 -11
- package/dist/src/session/handlers/chat-context.d.ts +0 -31
- package/dist/src/session/handlers/chat-events.d.ts +0 -5
- package/dist/src/session/handlers/chat-recovery.d.ts +0 -4
- package/dist/src/session/handlers/chat-session-lifecycle.d.ts +0 -9
- package/dist/src/session/handlers/chat.d.ts +0 -6
- package/dist/src/session/handlers/control.d.ts +0 -5
- package/dist/src/session/handlers/fs.d.ts +0 -14
- package/dist/src/session/handlers/message-status.d.ts +0 -3
- package/dist/src/session/handlers/pi-validation-session.d.ts +0 -7
- package/dist/src/session/handlers/pi-validation-session.js +0 -1
- package/dist/src/session/handlers/project-fs.d.ts +0 -11
- package/dist/src/session/handlers/remote-access.d.ts +0 -4
- package/dist/src/session/handlers/room-managed.d.ts +0 -6
- package/dist/src/session/handlers/session-refresh.d.ts +0 -3
- package/dist/src/session/handlers/title.d.ts +0 -3
- package/dist/src/session/handlers/tool-detail.d.ts +0 -3
- package/dist/src/session/handlers/voice-window.d.ts +0 -3
- package/dist/src/session/history-subscriptions.d.ts +0 -29
- package/dist/src/session/index-publisher.d.ts +0 -3
- package/dist/src/session/manager-event-authority.d.ts +0 -3
- package/dist/src/session/manager.d.ts +0 -95
- package/dist/src/session/native-cleanup-outbox.d.ts +0 -64
- package/dist/src/session/native-session-lifecycle.d.ts +0 -56
- package/dist/src/session/project-fs-store.d.ts +0 -43
- package/dist/src/session/projection.d.ts +0 -3
- package/dist/src/session/queue-control.d.ts +0 -27
- package/dist/src/session/queue-helpers.d.ts +0 -20
- package/dist/src/session/queue-message.d.ts +0 -35
- package/dist/src/session/queue-retry.d.ts +0 -11
- package/dist/src/session/queue-storage.d.ts +0 -8
- package/dist/src/session/queue-types.d.ts +0 -31
- package/dist/src/session/queue.d.ts +0 -73
- package/dist/src/session/queued-chat-dispatch.d.ts +0 -12
- package/dist/src/session/run-recovery/barrier.d.ts +0 -12
- package/dist/src/session/run-recovery/coordinator.d.ts +0 -32
- package/dist/src/session/run-recovery/journal.d.ts +0 -30
- package/dist/src/session/run-recovery/schema.d.ts +0 -48
- package/dist/src/session/store.d.ts +0 -128
- package/dist/src/session/tool-detail-store.d.ts +0 -17
- package/dist/src/session/turn-trigger.d.ts +0 -43
- package/dist/src/session/types.d.ts +0 -93
- package/dist/src/tools/markdown-to-pdf.d.ts +0 -42
- package/dist/src/upgrade/channel.d.ts +0 -5
- package/dist/src/upgrade/distribution.d.ts +0 -21
- package/dist/src/upgrade/engine.d.ts +0 -104
- package/dist/src/upgrade/scheduler.d.ts +0 -60
- package/dist/src/upgrade/updater-bootstrap.d.ts +0 -12
- package/dist/src/upgrade/updater-launcher.d.ts +0 -37
- package/dist/src/upgrade/updater-protocol.d.ts +0 -40
- package/dist/src/upgrade/updater-service-entry.d.ts +0 -7
- package/dist/src/upgrade/updater-worker.d.ts +0 -57
- package/dist/src/windows-shell.d.ts +0 -6
- package/node_modules/@shennian/wire/dist/agent-capabilities.d.ts +0 -16
- package/node_modules/@shennian/wire/dist/agent-workspace.d.ts +0 -133
- package/node_modules/@shennian/wire/dist/envelope.d.ts +0 -7
- package/node_modules/@shennian/wire/dist/events.d.ts +0 -125
- package/node_modules/@shennian/wire/dist/external-message-format.d.ts +0 -37
- package/node_modules/@shennian/wire/dist/frames.d.ts +0 -33
- package/node_modules/@shennian/wire/dist/fs.d.ts +0 -107
- package/node_modules/@shennian/wire/dist/index.d.ts +0 -21
- package/node_modules/@shennian/wire/dist/machine.d.ts +0 -160
- package/node_modules/@shennian/wire/dist/message-payload.d.ts +0 -71
- package/node_modules/@shennian/wire/dist/methods.d.ts +0 -5
- package/node_modules/@shennian/wire/dist/native-session.d.ts +0 -20
- package/node_modules/@shennian/wire/dist/project-fs.d.ts +0 -146
- package/node_modules/@shennian/wire/dist/project-path.d.ts +0 -4
- package/node_modules/@shennian/wire/dist/project.d.ts +0 -16
- package/node_modules/@shennian/wire/dist/relay-connectivity.d.ts +0 -30
- package/node_modules/@shennian/wire/dist/room.d.ts +0 -190
- package/node_modules/@shennian/wire/dist/schedule.d.ts +0 -37
- package/node_modules/@shennian/wire/dist/session-sync.d.ts +0 -406
- package/node_modules/@shennian/wire/dist/session.d.ts +0 -465
- package/node_modules/@shennian/wire/dist/tool-detail.d.ts +0 -38
- package/node_modules/@shennian/wire/dist/voice-chief.d.ts +0 -116
|
@@ -1,123 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// @test src/__tests__/session-sync.test.ts
|
|
3
|
-
export const SESSION_SYNC_PROTOCOL_VERSION = 2;
|
|
4
|
-
/**
|
|
5
|
-
* Monotonic authority generation for personal Session data. This is shared by
|
|
6
|
-
* daemon, Server and App; implementations must not carry a private cache epoch.
|
|
7
|
-
*/
|
|
8
|
-
export const SESSION_SYNC_DATA_EPOCH = 2;
|
|
9
|
-
export const SESSION_SYNC_RELEASE_GATE = {
|
|
10
|
-
minCliVersion: '0.3.65',
|
|
11
|
-
minAppBuild: { ios: 51, android: 12 },
|
|
12
|
-
minDesktopVersion: '0.4.0',
|
|
13
|
-
};
|
|
14
|
-
export const SESSION_SYNC_REQUIRED_CAPABILITIES = [
|
|
15
|
-
'session_index_v1',
|
|
16
|
-
'session_body_revision_v1',
|
|
17
|
-
'session_history_subscription_v1',
|
|
18
|
-
'local_canonical_v1',
|
|
19
|
-
'session_title_authority_v1',
|
|
20
|
-
'session_title_seed_v1',
|
|
21
|
-
'session_tool_detail_v1',
|
|
22
|
-
'voice_session_body_relay_v1',
|
|
23
|
-
'native_source_tombstone_v1',
|
|
24
|
-
'session_durable_send_v1',
|
|
25
|
-
'daemon_installation_identity_v1',
|
|
26
|
-
'session_user_boundary_v1',
|
|
27
|
-
'session_terminal_outbox_v1',
|
|
28
|
-
'session_list_preview_v1',
|
|
29
|
-
'session_attention_v1',
|
|
30
|
-
'session_data_epoch_v2',
|
|
31
|
-
'session_structured_rejection_v2',
|
|
32
|
-
'machine_personal_authority_v2',
|
|
33
|
-
];
|
|
34
|
-
/**
|
|
35
|
-
* Additive capabilities are advertised by new daemons but are not part of the
|
|
36
|
-
* epoch-wide minimum gate. This lets the App roll out background replication
|
|
37
|
-
* while old daemons keep serving the compatible visible-session snapshot path.
|
|
38
|
-
*/
|
|
39
|
-
export const SESSION_SYNC_ADDITIVE_CAPABILITIES = [
|
|
40
|
-
'session_body_replica_v1',
|
|
41
|
-
'session_body_replica_stream_v1',
|
|
42
|
-
'active_run_recovery_v1',
|
|
43
|
-
'external_updater_v1',
|
|
44
|
-
'room_message_delivery_v1',
|
|
45
|
-
];
|
|
46
|
-
export const SESSION_SYNC_ADVERTISED_CAPABILITIES = [
|
|
47
|
-
...SESSION_SYNC_REQUIRED_CAPABILITIES,
|
|
48
|
-
...SESSION_SYNC_ADDITIVE_CAPABILITIES,
|
|
49
|
-
];
|
|
50
|
-
export const SESSION_SYNC_EVENT_NAMES = [
|
|
51
|
-
'session.index.updated',
|
|
52
|
-
'session.body.delta',
|
|
53
|
-
'session.body.replica.delta',
|
|
54
|
-
'session.body.replica.error',
|
|
55
|
-
];
|
|
56
|
-
export const SESSION_HISTORY_LIMITS = {
|
|
57
|
-
defaultSnapshotMessages: 100,
|
|
58
|
-
maxSnapshotMessages: 500,
|
|
59
|
-
defaultPageMessages: 100,
|
|
60
|
-
maxPageMessages: 500,
|
|
61
|
-
maxDeltaMutations: 200,
|
|
62
|
-
maxMutationBytes: 256 * 1024,
|
|
63
|
-
maxReplicaPageBytes: 4 * 1024 * 1024,
|
|
64
|
-
maxSubscriptionsPerClient: 4,
|
|
65
|
-
maxSubscriptionsPerSession: 8,
|
|
66
|
-
maxReplicaStreamsPerDaemon: 8,
|
|
67
|
-
};
|
|
68
|
-
export const SESSION_TITLE_SOURCE_PRIORITY = {
|
|
69
|
-
first_user_fallback: 0,
|
|
70
|
-
shennian_generated: 1,
|
|
71
|
-
agent_native: 2,
|
|
72
|
-
shennian_manual: 3,
|
|
73
|
-
};
|
|
74
|
-
export function isSessionTitleSource(value) {
|
|
75
|
-
return typeof value === 'string' && value in SESSION_TITLE_SOURCE_PRIORITY;
|
|
76
|
-
}
|
|
77
|
-
export const SESSION_SYNC_REQUIRED_ACTIONS = [
|
|
78
|
-
'retry',
|
|
79
|
-
'reset_epoch',
|
|
80
|
-
'purge_session',
|
|
81
|
-
'quarantine_record',
|
|
82
|
-
'refresh_machine_ownership',
|
|
83
|
-
'upgrade_client',
|
|
84
|
-
'stop',
|
|
85
|
-
];
|
|
86
|
-
/** Privacy-safe regression cases shared by the cross-client hard-cut tests. */
|
|
87
|
-
export const PERSONAL_SYNC_FAILURE_FIXTURES = [
|
|
88
|
-
{
|
|
89
|
-
id: 'legacy_index_replay_after_server_reset',
|
|
90
|
-
ingress: 'session.index.updated',
|
|
91
|
-
condition: 'stale_data_epoch',
|
|
92
|
-
expectedCode: 'epoch_mismatch',
|
|
93
|
-
expectedAction: 'reset_epoch',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
id: 'personal_index_targets_room_session',
|
|
97
|
-
ingress: 'session.index.updated',
|
|
98
|
-
condition: 'room_binding_exists',
|
|
99
|
-
expectedCode: 'room_authority_conflict',
|
|
100
|
-
expectedAction: 'quarantine_record',
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: 'history_response_not_durably_applied',
|
|
104
|
-
ingress: 'session.history.open',
|
|
105
|
-
condition: 'network_success_cache_revision_zero',
|
|
106
|
-
expectedCode: 'revision_gap',
|
|
107
|
-
expectedAction: 'stop',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: 'native_path_move_replays_attention',
|
|
111
|
-
ingress: 'session.index.updated',
|
|
112
|
-
condition: 'same_source_event_identity',
|
|
113
|
-
expectedCode: 'invalid_payload',
|
|
114
|
-
expectedAction: 'quarantine_record',
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
export function getMissingSessionSyncCapabilities(capabilities) {
|
|
118
|
-
const available = new Set(capabilities ?? []);
|
|
119
|
-
return SESSION_SYNC_REQUIRED_CAPABILITIES.filter((capability) => !available.has(capability));
|
|
120
|
-
}
|
|
121
|
-
export function hasRequiredSessionSyncCapabilities(capabilities) {
|
|
122
|
-
return getMissingSessionSyncCapabilities(capabilities).length === 0;
|
|
123
|
-
}
|
|
1
|
+
const r=2,a=2,c={minCliVersion:"0.3.65",minAppBuild:{ios:51,android:12},minDesktopVersion:"0.4.0"},s=["session_index_v1","session_body_revision_v1","session_history_subscription_v1","local_canonical_v1","session_title_authority_v1","session_title_seed_v1","session_tool_detail_v1","voice_session_body_relay_v1","native_source_tombstone_v1","session_durable_send_v1","daemon_installation_identity_v1","session_user_boundary_v1","session_terminal_outbox_v1","session_list_preview_v1","session_attention_v1","session_data_epoch_v2","session_structured_rejection_v2","machine_personal_authority_v2"],n=["session_body_replica_v1","session_body_replica_stream_v1","active_run_recovery_v1","external_updater_v1","room_message_delivery_v1"],d=[...s,...n],p=["session.index.updated","session.body.delta","session.body.replica.delta","session.body.replica.error"],S={defaultSnapshotMessages:100,maxSnapshotMessages:500,defaultPageMessages:100,maxPageMessages:500,maxDeltaMutations:200,maxMutationBytes:256*1024,maxReplicaPageBytes:4*1024*1024,maxSubscriptionsPerClient:4,maxSubscriptionsPerSession:8,maxReplicaStreamsPerDaemon:8},t={first_user_fallback:0,shennian_generated:1,agent_native:2,shennian_manual:3};function l(e){return typeof e=="string"&&e in t}const u=["retry","reset_epoch","purge_session","quarantine_record","refresh_machine_ownership","upgrade_client","stop"],x=[{id:"legacy_index_replay_after_server_reset",ingress:"session.index.updated",condition:"stale_data_epoch",expectedCode:"epoch_mismatch",expectedAction:"reset_epoch"},{id:"personal_index_targets_room_session",ingress:"session.index.updated",condition:"room_binding_exists",expectedCode:"room_authority_conflict",expectedAction:"quarantine_record"},{id:"history_response_not_durably_applied",ingress:"session.history.open",condition:"network_success_cache_revision_zero",expectedCode:"revision_gap",expectedAction:"stop"},{id:"native_path_move_replays_attention",ingress:"session.index.updated",condition:"same_source_event_identity",expectedCode:"invalid_payload",expectedAction:"quarantine_record"}];function _(e){const o=new Set(e??[]);return s.filter(i=>!o.has(i))}function v(e){return _(e).length===0}export{x as PERSONAL_SYNC_FAILURE_FIXTURES,S as SESSION_HISTORY_LIMITS,n as SESSION_SYNC_ADDITIVE_CAPABILITIES,d as SESSION_SYNC_ADVERTISED_CAPABILITIES,a as SESSION_SYNC_DATA_EPOCH,p as SESSION_SYNC_EVENT_NAMES,r as SESSION_SYNC_PROTOCOL_VERSION,c as SESSION_SYNC_RELEASE_GATE,u as SESSION_SYNC_REQUIRED_ACTIONS,s as SESSION_SYNC_REQUIRED_CAPABILITIES,t as SESSION_TITLE_SOURCE_PRIORITY,_ as getMissingSessionSyncCapabilities,v as hasRequiredSessionSyncCapabilities,l as isSessionTitleSource};
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// @test packages/shared/src/__tests__/sync-engine.test.ts
|
|
3
|
-
/** The external Codex owner stopped its last turn, so its native queue is paused. */
|
|
4
|
-
export const CODEX_DESKTOP_SEND_UNAVAILABLE = 'codex_desktop_send_unavailable';
|
|
5
|
-
export const DISABLED_BUILTIN_AGENT_TYPES = [
|
|
6
|
-
'gemini',
|
|
7
|
-
'openclaw',
|
|
8
|
-
];
|
|
9
|
-
export const AVAILABLE_BUILTIN_AGENT_TYPES = [
|
|
10
|
-
'claude',
|
|
11
|
-
'codex',
|
|
12
|
-
'workbuddy',
|
|
13
|
-
// Gemini CLI is intentionally hidden from new sessions. Keep the historical
|
|
14
|
-
// AgentType and adapter intact so persisted sessions remain readable.
|
|
15
|
-
'cursor',
|
|
16
|
-
'opencode',
|
|
17
|
-
'pi',
|
|
18
|
-
'pi-coding-agent',
|
|
19
|
-
];
|
|
20
|
-
const AVAILABLE_BUILTIN_AGENT_TYPE_SET = new Set(AVAILABLE_BUILTIN_AGENT_TYPES);
|
|
21
|
-
export function isAvailableBuiltinAgentType(value) {
|
|
22
|
-
return AVAILABLE_BUILTIN_AGENT_TYPE_SET.has(value);
|
|
23
|
-
}
|
|
24
|
-
export function isAvailableAgentType(value) {
|
|
25
|
-
return value.startsWith('custom:')
|
|
26
|
-
|| /^acp:[a-z0-9][a-z0-9._-]{0,63}$/.test(value)
|
|
27
|
-
|| isAvailableBuiltinAgentType(value);
|
|
28
|
-
}
|
|
29
|
-
export function filterAvailableAgentTypes(values) {
|
|
30
|
-
const filtered = [];
|
|
31
|
-
const seen = new Set();
|
|
32
|
-
for (const value of values) {
|
|
33
|
-
if (!isAvailableAgentType(value) || seen.has(value))
|
|
34
|
-
continue;
|
|
35
|
-
seen.add(value);
|
|
36
|
-
filtered.push(value);
|
|
37
|
-
}
|
|
38
|
-
return filtered;
|
|
39
|
-
}
|
|
40
|
-
export function filterAvailableAgentInfos(agents) {
|
|
41
|
-
if (!agents?.length)
|
|
42
|
-
return [];
|
|
43
|
-
const filtered = [];
|
|
44
|
-
const seen = new Set();
|
|
45
|
-
for (const agent of agents) {
|
|
46
|
-
if (!isAvailableAgentType(agent.type) || seen.has(agent.type))
|
|
47
|
-
continue;
|
|
48
|
-
seen.add(agent.type);
|
|
49
|
-
filtered.push(agent);
|
|
50
|
-
}
|
|
51
|
-
return filtered;
|
|
52
|
-
}
|
|
53
|
-
/** Visibility is separate from access: an Owner can still open linked internal details. */
|
|
54
|
-
export function isInternalSession(session) {
|
|
55
|
-
return session.nativeSessionVisibility === 'internal'
|
|
56
|
-
|| session.id.startsWith('sess_worker_')
|
|
57
|
-
|| session.agentType === 'manager'
|
|
58
|
-
|| session.sessionMode === 'manager'
|
|
59
|
-
|| Boolean(session.agentIdentityId);
|
|
60
|
-
}
|
|
1
|
+
const c="codex_desktop_send_unavailable",p=["gemini","openclaw"],r=["claude","codex","workbuddy","cursor","opencode","pi","pi-coding-agent"],a=new Set(r);function s(e){return a.has(e)}function i(e){return e.startsWith("custom:")||/^acp:[a-z0-9][a-z0-9._-]{0,63}$/.test(e)||s(e)}function l(e){const n=[],o=new Set;for(const t of e)!i(t)||o.has(t)||(o.add(t),n.push(t));return n}function A(e){if(!e?.length)return[];const n=[],o=new Set;for(const t of e)!i(t.type)||o.has(t.type)||(o.add(t.type),n.push(t));return n}function u(e){return e.nativeSessionVisibility==="internal"||e.id.startsWith("sess_worker_")||e.agentType==="manager"||e.sessionMode==="manager"||!!e.agentIdentityId}export{r as AVAILABLE_BUILTIN_AGENT_TYPES,c as CODEX_DESKTOP_SEND_UNAVAILABLE,p as DISABLED_BUILTIN_AGENT_TYPES,A as filterAvailableAgentInfos,l as filterAvailableAgentTypes,i as isAvailableAgentType,s as isAvailableBuiltinAgentType,u as isInternalSession};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// @test src/__tests__/types.test.ts
|
|
3
|
-
export const SESSION_TOOL_DETAIL_LIMITS = {
|
|
4
|
-
defaultMaxBytes: 32 * 1024,
|
|
5
|
-
minMaxBytes: 4 * 1024,
|
|
6
|
-
maxMaxBytes: 64 * 1024,
|
|
7
|
-
responseTtlMs: 5 * 60 * 1_000,
|
|
8
|
-
relayTimeoutMs: 15 * 1_000,
|
|
9
|
-
};
|
|
1
|
+
const e={defaultMaxBytes:32768,minMaxBytes:4096,maxMaxBytes:65536,responseTtlMs:3e5,relayTimeoutMs:15e3};export{e as SESSION_TOOL_DETAIL_LIMITS};
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shennian",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Shennian — AI Agent Control Plane CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"shennian": "dist/bin/shennian.js"
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/src/index.js",
|
|
10
|
-
"types": "./dist/src/index.d.ts",
|
|
11
10
|
"files": [
|
|
12
11
|
"dist",
|
|
13
12
|
"README.md"
|
|
@@ -36,17 +35,13 @@
|
|
|
36
35
|
"console"
|
|
37
36
|
],
|
|
38
37
|
"author": "Shennian",
|
|
39
|
-
"license": "
|
|
40
|
-
"repository": {
|
|
41
|
-
"type": "git",
|
|
42
|
-
"url": "https://github.com/CosmosShadow/shennian_cli"
|
|
43
|
-
},
|
|
38
|
+
"license": "UNLICENSED",
|
|
44
39
|
"engines": {
|
|
45
40
|
"node": ">=18"
|
|
46
41
|
},
|
|
47
42
|
"scripts": {
|
|
48
43
|
"build": "node -e \"require('node:fs').rmSync('dist/native/macos-background-client', { recursive: true, force: true })\" && tsc && node -e \"require('node:fs').chmodSync('dist/bin/shennian.js', 0o755)\"",
|
|
49
|
-
"build:publish": "pnpm --filter @shennian/wire build:publish && node -e \"const fs=require('node:fs'); fs.rmSync('dist', { recursive: true, force: true }); fs.rmSync('.tsbuildinfo.publish', { force: true })\" && tsc -p tsconfig.publish.json && node scripts/minify-publish-js.mjs && node -e \"require('node:fs').chmodSync('dist/bin/shennian.js', 0o755)\" && node scripts/check-publish-artifact.mjs",
|
|
44
|
+
"build:publish": "pnpm --filter @shennian/wire build:publish && node -e \"const fs=require('node:fs'); fs.rmSync('dist', { recursive: true, force: true }); fs.rmSync('.tsbuildinfo.publish', { force: true })\" && tsc -p tsconfig.publish.json && node scripts/minify-publish-js.mjs && node scripts/strip-publish-types.mjs dist && node -e \"require('node:fs').chmodSync('dist/bin/shennian.js', 0o755)\" && node scripts/check-publish-artifact.mjs",
|
|
50
45
|
"test:security:codex": "tsx scripts/verify-managed-codex-sandbox.ts",
|
|
51
46
|
"test:security:codex-tools": "tsx scripts/verify-managed-codex-dynamic-tools.ts",
|
|
52
47
|
"dev": "tsc --watch",
|
package/dist/bin/shennian.d.ts
DELETED
package/dist/src/agent-env.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { AgentType } from '@shennian/wire';
|
|
2
|
-
/**
|
|
3
|
-
* Session-scoped Shennian capabilities that are intentionally available to a
|
|
4
|
-
* managed Agent. Any new entry is a security boundary change and must have a
|
|
5
|
-
* matching authorization test before being added here.
|
|
6
|
-
*/
|
|
7
|
-
export declare const MANAGED_AGENT_SESSION_ENV_KEYS: readonly ["SHENNIAN_MANAGED_ROOM_CONTEXT", "SHENNIAN_MANAGED_ROOM_IPC_ROOT"];
|
|
8
|
-
export declare function getManagedAgentProviderEnvKeys(agentType: AgentType): readonly string[];
|
|
9
|
-
export declare function getManagedAgentSessionEnvKeys(agentType: AgentType): readonly string[];
|
|
10
|
-
export declare function getManagedAgentBaseEnvKeys(platform?: NodeJS.Platform): readonly string[];
|
|
11
|
-
export type ManagedAgentProcessEnvInput = {
|
|
12
|
-
agentType: AgentType;
|
|
13
|
-
/** The daemon snapshot is read only for explicitly allowlisted OS values. */
|
|
14
|
-
daemonEnv?: NodeJS.ProcessEnv;
|
|
15
|
-
/** Provider credentials already selected by Shennian's provider config. */
|
|
16
|
-
providerEnv?: NodeJS.ProcessEnv;
|
|
17
|
-
/** Short-lived Room or Manager capabilities issued for this exact session. */
|
|
18
|
-
sessionEnv?: NodeJS.ProcessEnv;
|
|
19
|
-
/** Harmless process behavior flags such as NO_COLOR. */
|
|
20
|
-
runtimeEnv?: NodeJS.ProcessEnv;
|
|
21
|
-
platform?: NodeJS.Platform;
|
|
22
|
-
};
|
|
23
|
-
export declare function readLatestUserEnv(): NodeJS.ProcessEnv;
|
|
24
|
-
export declare function mergeAgentProcessEnv(input: {
|
|
25
|
-
daemonEnv: NodeJS.ProcessEnv;
|
|
26
|
-
userEnv: NodeJS.ProcessEnv;
|
|
27
|
-
extra?: NodeJS.ProcessEnv;
|
|
28
|
-
}): NodeJS.ProcessEnv;
|
|
29
|
-
export declare function buildAgentProcessEnv(extra?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
30
|
-
/**
|
|
31
|
-
* Reuses the ordinary Agent environment while keeping daemon/account secrets
|
|
32
|
-
* out of an automatically activated managed Room process. Only the explicit,
|
|
33
|
-
* short-lived Room and Manager capabilities may cross this boundary.
|
|
34
|
-
*/
|
|
35
|
-
export declare function buildManagedNativeFullProcessEnv(extra?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
36
|
-
/**
|
|
37
|
-
* Builds the environment for an automatically activated managed Agent.
|
|
38
|
-
*
|
|
39
|
-
* Unlike buildAgentProcessEnv(), this function never starts a login shell and
|
|
40
|
-
* never merges the daemon environment wholesale. Provider and Shennian
|
|
41
|
-
* capability values must be supplied in their dedicated buckets; unexpected
|
|
42
|
-
* keys are dropped instead of silently broadening the child's authority.
|
|
43
|
-
*/
|
|
44
|
-
export declare function buildManagedAgentProcessEnv(input: ManagedAgentProcessEnvInput): NodeJS.ProcessEnv;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { AcpAgentType, ChatAttachmentMeta } from '@shennian/wire';
|
|
2
|
-
import { AgentAdapter, type ImportedAgentMessage } from '../adapter.js';
|
|
3
|
-
import { type AcpAgentManifest } from './types.js';
|
|
4
|
-
import { type CompiledManagedAgentPolicy } from '../../security/managed-agent-policy.js';
|
|
5
|
-
export declare class AcpAgentAdapter extends AgentAdapter {
|
|
6
|
-
private readonly manifest;
|
|
7
|
-
private readonly options;
|
|
8
|
-
readonly type: AcpAgentType;
|
|
9
|
-
get recoveryCapabilities(): {
|
|
10
|
-
inspectTerminal: boolean;
|
|
11
|
-
reattachRun: boolean;
|
|
12
|
-
resumeRun: boolean;
|
|
13
|
-
resumeSession: boolean;
|
|
14
|
-
};
|
|
15
|
-
private client;
|
|
16
|
-
private workDir;
|
|
17
|
-
private shennianSessionId;
|
|
18
|
-
private requestedSessionId;
|
|
19
|
-
private agentSessionId;
|
|
20
|
-
private runId;
|
|
21
|
-
private seq;
|
|
22
|
-
private active;
|
|
23
|
-
private extraEnv;
|
|
24
|
-
private pendingPermissions;
|
|
25
|
-
private configOptions;
|
|
26
|
-
private modes;
|
|
27
|
-
private importCapture;
|
|
28
|
-
private emittedToolStates;
|
|
29
|
-
private pendingAuthRetry;
|
|
30
|
-
private retryingAfterAuth;
|
|
31
|
-
private managedAgentPolicy;
|
|
32
|
-
private configurationSignature;
|
|
33
|
-
private startedConfigurationSignature;
|
|
34
|
-
constructor(manifest: AcpAgentManifest, options?: {
|
|
35
|
-
permissionTimeoutMs?: number;
|
|
36
|
-
promptTimeoutMs?: number;
|
|
37
|
-
});
|
|
38
|
-
configure(options: {
|
|
39
|
-
env?: NodeJS.ProcessEnv;
|
|
40
|
-
managedAgentPolicy?: CompiledManagedAgentPolicy | null;
|
|
41
|
-
}): void;
|
|
42
|
-
start(sessionId: string, workDir: string, agentSessionId?: string | null): Promise<void>;
|
|
43
|
-
send(text: string, modelId?: string, reasoningEffort?: string, attachments?: ChatAttachmentMeta[], systemPrompt?: string | null): Promise<void>;
|
|
44
|
-
resume(agentSessionId: string): Promise<void>;
|
|
45
|
-
stop(): Promise<void>;
|
|
46
|
-
getStatus(): Promise<{
|
|
47
|
-
active: boolean;
|
|
48
|
-
runId: string | null;
|
|
49
|
-
canStop: boolean;
|
|
50
|
-
}>;
|
|
51
|
-
respondToPermission(permissionId: string, optionId: string): Promise<void>;
|
|
52
|
-
getAuthMethods(): import('@agentclientprotocol/sdk').AuthMethod[];
|
|
53
|
-
hasPendingAuthenticationRetry(): boolean;
|
|
54
|
-
getSessionOptions(): import('../adapter.js').AgentSessionOptions;
|
|
55
|
-
authenticate(methodId: string, options?: {
|
|
56
|
-
interactiveTerminal?: boolean;
|
|
57
|
-
}): Promise<void>;
|
|
58
|
-
logout(): Promise<void>;
|
|
59
|
-
resumeAfterExternalAuthentication(): Promise<void>;
|
|
60
|
-
listExternalSessions(options?: {
|
|
61
|
-
cwd?: string;
|
|
62
|
-
}): Promise<import("@shennian/wire").AcpExternalSessionInfo[]>;
|
|
63
|
-
loadExternalSession(agentSessionId: string): Promise<ImportedAgentMessage[]>;
|
|
64
|
-
closeExternalSession(agentSessionId: string): Promise<void>;
|
|
65
|
-
deleteExternalSession(agentSessionId: string): Promise<void>;
|
|
66
|
-
private ensureSession;
|
|
67
|
-
private applyDynamicConfig;
|
|
68
|
-
private handleSessionUpdate;
|
|
69
|
-
private captureImportedUpdate;
|
|
70
|
-
private handlePermission;
|
|
71
|
-
private requireClient;
|
|
72
|
-
private createProcessClient;
|
|
73
|
-
private refreshProcessConfiguration;
|
|
74
|
-
private buildEnvironment;
|
|
75
|
-
private buildClientCapabilities;
|
|
76
|
-
private retryAfterAuthentication;
|
|
77
|
-
private promptWithTimeout;
|
|
78
|
-
private cancelPendingPermissions;
|
|
79
|
-
private makeEvent;
|
|
80
|
-
private emitEvent;
|
|
81
|
-
}
|
|
82
|
-
export declare function registerAcpAgent(manifest: AcpAgentManifest): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type StdioOptions } from 'node:child_process';
|
|
2
|
-
import type { AuthMethodTerminal } from '@agentclientprotocol/sdk';
|
|
3
|
-
import type { AcpLaunchSpec } from './types.js';
|
|
4
|
-
export declare function runAcpTerminalAuthentication(launch: AcpLaunchSpec, method: AuthMethodTerminal, cwd: string, options?: {
|
|
5
|
-
requireTty?: boolean;
|
|
6
|
-
stdio?: StdioOptions;
|
|
7
|
-
}): Promise<void>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { DetectedAgent } from '../detect.js';
|
|
2
|
-
import type { AcpAgentManifest } from './types.js';
|
|
3
|
-
export declare function buildAcpCapabilityCacheKey(input: {
|
|
4
|
-
manifest: AcpAgentManifest;
|
|
5
|
-
platform: NodeJS.Platform;
|
|
6
|
-
catalogRevision?: string;
|
|
7
|
-
executableIdentity?: {
|
|
8
|
-
pathHash: string;
|
|
9
|
-
fingerprint: string;
|
|
10
|
-
} | null;
|
|
11
|
-
}): string | null;
|
|
12
|
-
export declare function readAcpCapabilityCache(key: string): DetectedAgent | null;
|
|
13
|
-
export declare function writeAcpCapabilityCache(key: string, agent: DetectedAgent): void;
|
|
14
|
-
export declare function clearAcpCapabilityCache(): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AcpCatalogPlatform } from '@shennian/wire';
|
|
2
|
-
import type { AcpAgentManifest } from './types.js';
|
|
3
|
-
export declare function loadAcpCatalog(options?: {
|
|
4
|
-
serverUrl?: string;
|
|
5
|
-
authToken?: string;
|
|
6
|
-
fetchImpl?: typeof fetch;
|
|
7
|
-
}): Promise<{
|
|
8
|
-
revision?: string;
|
|
9
|
-
candidates: AcpAgentManifest[];
|
|
10
|
-
}>;
|
|
11
|
-
export declare function currentAcpPlatform(): AcpCatalogPlatform;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type * as acp from '@agentclientprotocol/sdk';
|
|
2
|
-
export type AcpTerminalPolicy = 'unrestricted' | 'managed-room-only';
|
|
3
|
-
export declare class AcpClientServices {
|
|
4
|
-
readonly enabled: {
|
|
5
|
-
readTextFile?: boolean;
|
|
6
|
-
writeTextFile?: boolean;
|
|
7
|
-
terminal?: boolean;
|
|
8
|
-
terminalPolicy?: AcpTerminalPolicy;
|
|
9
|
-
};
|
|
10
|
-
private readonly root;
|
|
11
|
-
private readonly environment;
|
|
12
|
-
private readonly terminals;
|
|
13
|
-
constructor(workDir: string, enabled: {
|
|
14
|
-
readTextFile?: boolean;
|
|
15
|
-
writeTextFile?: boolean;
|
|
16
|
-
terminal?: boolean;
|
|
17
|
-
terminalPolicy?: AcpTerminalPolicy;
|
|
18
|
-
}, environment?: NodeJS.ProcessEnv);
|
|
19
|
-
get capabilities(): {
|
|
20
|
-
fs: {
|
|
21
|
-
readTextFile: boolean;
|
|
22
|
-
writeTextFile: boolean;
|
|
23
|
-
};
|
|
24
|
-
terminal: boolean;
|
|
25
|
-
};
|
|
26
|
-
readTextFile(params: acp.ReadTextFileRequest): Promise<acp.ReadTextFileResponse>;
|
|
27
|
-
writeTextFile(params: acp.WriteTextFileRequest): Promise<void>;
|
|
28
|
-
createTerminal(params: acp.CreateTerminalRequest): Promise<acp.CreateTerminalResponse>;
|
|
29
|
-
terminalOutput(params: acp.TerminalOutputRequest): acp.TerminalOutputResponse;
|
|
30
|
-
waitForTerminalExit(params: acp.WaitForTerminalExitRequest): Promise<acp.WaitForTerminalExitResponse>;
|
|
31
|
-
killTerminal(params: acp.KillTerminalRequest): void;
|
|
32
|
-
releaseTerminal(params: acp.ReleaseTerminalRequest): void;
|
|
33
|
-
close(): void;
|
|
34
|
-
private requireTerminal;
|
|
35
|
-
private resolveTerminalInvocation;
|
|
36
|
-
private resolve;
|
|
37
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DetectedAgent } from '../detect.js';
|
|
2
|
-
import { type AcpAgentManifest } from './types.js';
|
|
3
|
-
export declare function discoverAcpAgents(options?: {
|
|
4
|
-
candidates?: AcpAgentManifest[];
|
|
5
|
-
cwd?: string;
|
|
6
|
-
serverUrl?: string;
|
|
7
|
-
authToken?: string;
|
|
8
|
-
fetchImpl?: typeof fetch;
|
|
9
|
-
agentType?: string;
|
|
10
|
-
}): Promise<DetectedAgent[]>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SessionUpdate } from '@agentclientprotocol/sdk';
|
|
2
|
-
import type { AgentEvent } from '../adapter.js';
|
|
3
|
-
export type AcpEventFactory = (partial: Omit<AgentEvent, 'runId' | 'seq'>) => AgentEvent;
|
|
4
|
-
export declare function mapAcpSessionUpdate(update: SessionUpdate, makeEvent: AcpEventFactory): AgentEvent[];
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { AcpAgentManifest } from './types.js';
|
|
3
|
-
export declare const ACP_MANIFEST_SCHEMA_ID = "https://shennian.net/schemas/acp-agent-manifest-v1.json";
|
|
4
|
-
export declare const ACP_MANIFEST_DIRECTORY = "acp-agents.d";
|
|
5
|
-
declare const manifestSchema: z.ZodObject<{
|
|
6
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
7
|
-
id: z.ZodString;
|
|
8
|
-
name: z.ZodString;
|
|
9
|
-
protocol: z.ZodLiteral<"acp">;
|
|
10
|
-
command: z.ZodString;
|
|
11
|
-
args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
-
homepage: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
14
|
-
clientCapabilities: z.ZodOptional<z.ZodObject<{
|
|
15
|
-
readTextFile: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
-
writeTextFile: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
-
terminal: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
-
}, "strict", z.ZodTypeAny, {
|
|
19
|
-
terminal: boolean;
|
|
20
|
-
readTextFile: boolean;
|
|
21
|
-
writeTextFile: boolean;
|
|
22
|
-
}, {
|
|
23
|
-
terminal?: boolean | undefined;
|
|
24
|
-
readTextFile?: boolean | undefined;
|
|
25
|
-
writeTextFile?: boolean | undefined;
|
|
26
|
-
}>>;
|
|
27
|
-
}, "strict", z.ZodTypeAny, {
|
|
28
|
-
id: string;
|
|
29
|
-
schemaVersion: 1;
|
|
30
|
-
name: string;
|
|
31
|
-
args: string[];
|
|
32
|
-
command: string;
|
|
33
|
-
protocol: "acp";
|
|
34
|
-
enabled: boolean;
|
|
35
|
-
homepage?: string | undefined;
|
|
36
|
-
clientCapabilities?: {
|
|
37
|
-
terminal: boolean;
|
|
38
|
-
readTextFile: boolean;
|
|
39
|
-
writeTextFile: boolean;
|
|
40
|
-
} | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
id: string;
|
|
43
|
-
schemaVersion: 1;
|
|
44
|
-
name: string;
|
|
45
|
-
command: string;
|
|
46
|
-
protocol: "acp";
|
|
47
|
-
args?: string[] | undefined;
|
|
48
|
-
enabled?: boolean | undefined;
|
|
49
|
-
homepage?: string | undefined;
|
|
50
|
-
clientCapabilities?: {
|
|
51
|
-
terminal?: boolean | undefined;
|
|
52
|
-
readTextFile?: boolean | undefined;
|
|
53
|
-
writeTextFile?: boolean | undefined;
|
|
54
|
-
} | undefined;
|
|
55
|
-
}>;
|
|
56
|
-
export type AcpManifestDocument = z.infer<typeof manifestSchema>;
|
|
57
|
-
export declare function getAcpManifestDirectory(): string;
|
|
58
|
-
export declare function validateAcpManifest(input: unknown): AcpManifestDocument;
|
|
59
|
-
export declare function readAcpManifests(directory?: string): AcpAgentManifest[];
|
|
60
|
-
export declare function writeAcpManifest(document: AcpManifestDocument, directory?: string): string;
|
|
61
|
-
export declare function removeAcpManifest(id: string, directory?: string): boolean;
|
|
62
|
-
export declare function validateAcpId(id: string): string;
|
|
63
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare function recordAcpScan(input: {
|
|
2
|
-
durationMs: number;
|
|
3
|
-
candidateCount: number;
|
|
4
|
-
installedCount: number;
|
|
5
|
-
cacheHits: number;
|
|
6
|
-
handshakeFailures: number;
|
|
7
|
-
handshakeFailuresByKind: Record<string, number>;
|
|
8
|
-
}): void;
|
|
9
|
-
export declare function recordAcpAuthFailure(): void;
|
|
10
|
-
export declare function recordAcpImportResult(ok: boolean): void;
|
|
11
|
-
export declare function getAcpLocalMetrics(): {
|
|
12
|
-
handshakeFailuresByKind: {
|
|
13
|
-
[x: string]: number;
|
|
14
|
-
};
|
|
15
|
-
scans: number;
|
|
16
|
-
lastScanDurationMs: number;
|
|
17
|
-
lastCandidateCount: number;
|
|
18
|
-
lastInstalledCount: number;
|
|
19
|
-
cacheHits: number;
|
|
20
|
-
handshakeFailures: number;
|
|
21
|
-
authFailures: number;
|
|
22
|
-
importSuccess: number;
|
|
23
|
-
importFailure: number;
|
|
24
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as acp from '@agentclientprotocol/sdk';
|
|
2
|
-
import type { InitializeResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification } from '@agentclientprotocol/sdk';
|
|
3
|
-
import type { AcpLaunchSpec } from './types.js';
|
|
4
|
-
import { type AcpTerminalPolicy } from './client-services.js';
|
|
5
|
-
export type AcpProcessClientHandlers = {
|
|
6
|
-
onSessionUpdate(params: SessionNotification): void | Promise<void>;
|
|
7
|
-
onPermission(params: RequestPermissionRequest): Promise<RequestPermissionResponse>;
|
|
8
|
-
};
|
|
9
|
-
export declare class AcpProcessClient {
|
|
10
|
-
private readonly launch;
|
|
11
|
-
private readonly handlers;
|
|
12
|
-
private readonly environment;
|
|
13
|
-
private readonly clientCapabilities;
|
|
14
|
-
private readonly timeouts;
|
|
15
|
-
private process;
|
|
16
|
-
private connection;
|
|
17
|
-
private initialization;
|
|
18
|
-
private stderr;
|
|
19
|
-
private clientServices;
|
|
20
|
-
constructor(launch: AcpLaunchSpec, handlers: AcpProcessClientHandlers, environment?: NodeJS.ProcessEnv, clientCapabilities?: {
|
|
21
|
-
readTextFile?: boolean;
|
|
22
|
-
writeTextFile?: boolean;
|
|
23
|
-
terminal?: boolean;
|
|
24
|
-
terminalAuth?: boolean;
|
|
25
|
-
terminalPolicy?: AcpTerminalPolicy;
|
|
26
|
-
}, timeouts?: {
|
|
27
|
-
initializeMs?: number;
|
|
28
|
-
sessionMs?: number;
|
|
29
|
-
authMs?: number;
|
|
30
|
-
});
|
|
31
|
-
get capabilities(): NonNullable<InitializeResponse['agentCapabilities']>;
|
|
32
|
-
get initializeResponse(): InitializeResponse | null;
|
|
33
|
-
listSessions(cwd?: string, cursor?: string | null): Promise<acp.ListSessionsResponse>;
|
|
34
|
-
authenticate(methodId: string): Promise<void>;
|
|
35
|
-
logout(): Promise<void>;
|
|
36
|
-
closeSession(sessionId: string): Promise<void>;
|
|
37
|
-
deleteSession(sessionId: string): Promise<void>;
|
|
38
|
-
get agent(): acp.ClientContext;
|
|
39
|
-
start(cwd: string): Promise<InitializeResponse>;
|
|
40
|
-
close(): Promise<void>;
|
|
41
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { AcpAgentType } from '@shennian/wire';
|
|
2
|
-
import type { AgentCapabilities, AuthMethod, Implementation } from '@agentclientprotocol/sdk';
|
|
3
|
-
export type AcpLaunchSpec = {
|
|
4
|
-
command: string;
|
|
5
|
-
args?: string[];
|
|
6
|
-
env?: Record<string, string>;
|
|
7
|
-
};
|
|
8
|
-
export type AcpAgentManifest = {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
launch: AcpLaunchSpec;
|
|
12
|
-
/** Original command before platform shim wrapping; used to append terminal-auth args safely. */
|
|
13
|
-
authLaunch?: AcpLaunchSpec;
|
|
14
|
-
homepage?: string;
|
|
15
|
-
source?: 'registry' | 'local';
|
|
16
|
-
packageHints?: {
|
|
17
|
-
npm?: string;
|
|
18
|
-
uv?: string;
|
|
19
|
-
};
|
|
20
|
-
clientCapabilities?: {
|
|
21
|
-
readTextFile?: boolean;
|
|
22
|
-
writeTextFile?: boolean;
|
|
23
|
-
terminal?: boolean;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export type AcpInitialization = {
|
|
27
|
-
agentInfo?: Implementation | null;
|
|
28
|
-
authMethods: AuthMethod[];
|
|
29
|
-
capabilities: AgentCapabilities;
|
|
30
|
-
};
|
|
31
|
-
export declare function acpAgentType(id: string): AcpAgentType;
|