shennian 0.3.72 → 0.3.74
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/dist/publish-build-manifest.json +126 -61
- package/dist/src/agent-env.d.ts +30 -0
- package/dist/src/agent-env.js +4 -4
- package/dist/src/agents/adapter.d.ts +5 -0
- package/dist/src/agents/claude-managed-permissions.d.ts +33 -0
- package/dist/src/agents/claude-managed-permissions.js +1 -0
- package/dist/src/agents/claude.d.ts +11 -2
- package/dist/src/agents/claude.js +5 -5
- package/dist/src/agents/codex-managed-permissions.d.ts +32 -0
- package/dist/src/agents/codex-managed-permissions.js +1 -0
- package/dist/src/agents/codex-managed-room-tools.d.ts +40 -0
- package/dist/src/agents/codex-managed-room-tools.js +1 -0
- package/dist/src/agents/codex.d.ts +20 -2
- package/dist/src/agents/codex.js +11 -10
- package/dist/src/agents/command-spec.d.ts +8 -0
- package/dist/src/agents/command-spec.js +3 -2
- package/dist/src/agents/cursor-managed-permissions.d.ts +28 -0
- package/dist/src/agents/cursor-managed-permissions.js +2 -0
- package/dist/src/agents/cursor.d.ts +8 -2
- package/dist/src/agents/cursor.js +1 -1
- package/dist/src/agents/custom-managed-runtime.d.ts +37 -0
- package/dist/src/agents/custom-managed-runtime.js +2 -0
- package/dist/src/agents/custom.d.ts +12 -2
- package/dist/src/agents/custom.js +4 -4
- package/dist/src/agents/detect.d.ts +3 -0
- package/dist/src/agents/detect.js +1 -1
- package/dist/src/agents/model-registry/service.js +1 -1
- package/dist/src/agents/opencode-managed-permissions.d.ts +25 -0
- package/dist/src/agents/opencode-managed-permissions.js +2 -0
- package/dist/src/agents/opencode.d.ts +8 -2
- package/dist/src/agents/opencode.js +1 -1
- package/dist/src/agents/workbuddy-managed-permissions.d.ts +37 -0
- package/dist/src/agents/workbuddy-managed-permissions.js +2 -0
- package/dist/src/agents/workbuddy.d.ts +8 -0
- package/dist/src/agents/workbuddy.js +2 -2
- package/dist/src/commands/daemon.d.ts +29 -0
- package/dist/src/commands/daemon.js +14 -14
- package/dist/src/commands/room.js +3 -3
- package/dist/src/commands/runtime.js +5 -5
- package/dist/src/config/index.d.ts +22 -0
- package/dist/src/daemon-ipc/paths.d.ts +8 -0
- package/dist/src/daemon-ipc/paths.js +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/log-redaction.d.ts +4 -0
- package/dist/src/log-redaction.js +1 -0
- package/dist/src/relay/client.d.ts +1 -0
- package/dist/src/relay/client.js +1 -1
- package/dist/src/room/activation-service.d.ts +32 -21
- package/dist/src/room/activation-service.js +5 -5
- package/dist/src/room/attachment-cache.d.ts +3 -0
- package/dist/src/room/attachment-cache.js +2 -2
- package/dist/src/room/attachment-upload.js +1 -1
- package/dist/src/room/managed-context.d.ts +2 -0
- package/dist/src/room/managed-context.js +1 -1
- package/dist/src/room/managed-prompt-composer.d.ts +16 -3
- package/dist/src/room/managed-prompt-composer.js +26 -13
- package/dist/src/room/managed-room-binding.d.ts +3 -3
- package/dist/src/room/managed-room-binding.js +1 -1
- package/dist/src/room/managed-room-ipc.d.ts +32 -0
- package/dist/src/room/managed-room-ipc.js +3 -1
- package/dist/src/room/mirror-sync-service.js +1 -1
- package/dist/src/room/room-action-client.d.ts +5 -1
- package/dist/src/room/room-action-client.js +1 -1
- package/dist/src/room/session-registry.d.ts +4 -0
- package/dist/src/room/session-registry.js +2 -2
- package/dist/src/security/managed-agent-credential-paths.d.ts +6 -0
- package/dist/src/security/managed-agent-credential-paths.js +1 -0
- package/dist/src/security/managed-agent-executable.d.ts +19 -0
- package/dist/src/security/managed-agent-executable.js +1 -0
- package/dist/src/security/managed-agent-policy.d.ts +55 -0
- package/dist/src/security/managed-agent-policy.js +1 -0
- package/dist/src/security/managed-agent-runtime.d.ts +44 -0
- package/dist/src/security/managed-agent-runtime.js +1 -0
- package/dist/src/session/handlers/chat.d.ts +8 -1
- package/dist/src/session/handlers/chat.js +2 -2
- package/dist/src/session/handlers/remote-access.d.ts +4 -0
- package/dist/src/session/handlers/remote-access.js +1 -0
- package/dist/src/session/handlers/room-managed.d.ts +1 -1
- package/dist/src/session/handlers/room-managed.js +1 -1
- package/dist/src/session/history-subscriptions.d.ts +6 -0
- package/dist/src/session/history-subscriptions.js +1 -1
- package/dist/src/session/manager.d.ts +15 -19
- package/dist/src/session/manager.js +1 -1
- package/dist/src/session/queue.d.ts +26 -3
- package/dist/src/session/queue.js +11 -4
- package/dist/src/session/types.d.ts +14 -0
- package/node_modules/@shennian/wire/dist/agent-workspace.d.ts +70 -0
- package/node_modules/@shennian/wire/dist/agent-workspace.js +111 -1
- package/node_modules/@shennian/wire/dist/machine.d.ts +2 -0
- package/node_modules/@shennian/wire/dist/methods.d.ts +1 -1
- package/node_modules/@shennian/wire/dist/session-sync.d.ts +53 -3
- package/node_modules/@shennian/wire/dist/session-sync.js +5 -1
- package/node_modules/@shennian/wire/dist/session.d.ts +2 -0
- package/package.json +3 -1
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
import type { AgentType, ManagerConfig, SessionMode } from './session.ts';
|
|
2
2
|
import type { AgentRepairAction, AgentRuntimeAvailability, RoomActivationMode } from './room.ts';
|
|
3
|
+
export declare const MANAGED_AGENT_PERMISSION_POLICY_VERSION = 1;
|
|
4
|
+
export type ManagedAgentFileAccess = 'workspace-read' | 'workspace-write' | 'host-full';
|
|
5
|
+
export type ManagedAgentExternalCapabilities = {
|
|
6
|
+
commandNetwork: boolean;
|
|
7
|
+
webSearch: boolean;
|
|
8
|
+
browser: boolean;
|
|
9
|
+
computerUse: boolean;
|
|
10
|
+
mcp: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ManagedAgentPermissionPolicy = {
|
|
13
|
+
/** Monotonic AgentIdentity policy revision, owned by the server. */
|
|
14
|
+
version: number;
|
|
15
|
+
fileAccess: ManagedAgentFileAccess;
|
|
16
|
+
externalCapabilities: ManagedAgentExternalCapabilities;
|
|
17
|
+
};
|
|
18
|
+
export type ManagedAgentEnforcementLevel = 'hard' | 'partial' | 'unverified';
|
|
19
|
+
export type ManagedAgentRuntimeCapabilityMatrix = {
|
|
20
|
+
fileAccess: Record<ManagedAgentFileAccess, boolean>;
|
|
21
|
+
externalCapabilities: {
|
|
22
|
+
[Capability in keyof ManagedAgentExternalCapabilities]: {
|
|
23
|
+
allow: boolean;
|
|
24
|
+
deny: boolean;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type ManagedAgentRuntimeProtection = {
|
|
29
|
+
level: ManagedAgentEnforcementLevel;
|
|
30
|
+
runtimeVersion: string;
|
|
31
|
+
platform: string;
|
|
32
|
+
/** Stable digest of the exact executable selected by the daemon. Absent on older daemons. */
|
|
33
|
+
executableFingerprint?: string;
|
|
34
|
+
unsupportedCapabilities: string[];
|
|
35
|
+
/** Directional native capability evidence; absent means the runtime is not trusted. */
|
|
36
|
+
capabilityMatrix?: ManagedAgentRuntimeCapabilityMatrix;
|
|
37
|
+
};
|
|
38
|
+
export type ManagedAgentEnforcement = ManagedAgentRuntimeProtection & {
|
|
39
|
+
effectivePolicy: ManagedAgentPermissionPolicy;
|
|
40
|
+
};
|
|
41
|
+
/** One-time request proving that the user accepted the currently displayed runtime risk. */
|
|
42
|
+
export type ManagedAgentPermissionConfirmationRequest = {
|
|
43
|
+
runtimeAdapter: AgentType;
|
|
44
|
+
runtimeVersion: string;
|
|
45
|
+
platform: string;
|
|
46
|
+
executableFingerprint: string;
|
|
47
|
+
hostFullAccess: boolean;
|
|
48
|
+
limitedProtection: boolean;
|
|
49
|
+
};
|
|
50
|
+
/** Server-owned confirmation bound to one policy revision and one exact local runtime. */
|
|
51
|
+
export type ManagedAgentPermissionConfirmation = ManagedAgentPermissionConfirmationRequest & {
|
|
52
|
+
policyVersion: number;
|
|
53
|
+
confirmedAt: string;
|
|
54
|
+
};
|
|
55
|
+
export declare const DEFAULT_MANAGED_AGENT_PERMISSION_POLICY: ManagedAgentPermissionPolicy;
|
|
56
|
+
/**
|
|
57
|
+
* Compatibility projection for payloads created before managed permissions existed.
|
|
58
|
+
* Missing policy data must never be presented as if a restrictive sandbox were active.
|
|
59
|
+
*/
|
|
60
|
+
export declare const LEGACY_MANAGED_AGENT_PERMISSION_POLICY: ManagedAgentPermissionPolicy;
|
|
61
|
+
/**
|
|
62
|
+
* Project the policy the runtime can actually guarantee. Missing directional
|
|
63
|
+
* evidence is treated as possible host-wide file and external access.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveManagedAgentEffectivePermissionPolicy(requested: ManagedAgentPermissionPolicy, protection?: ManagedAgentRuntimeProtection | null): ManagedAgentPermissionPolicy;
|
|
66
|
+
/** Strictly parse an explicit policy. Invalid or incomplete values are not silently repaired. */
|
|
67
|
+
export declare function parseManagedAgentPermissionPolicy(value: unknown): ManagedAgentPermissionPolicy | null;
|
|
68
|
+
export declare function resolveManagedAgentPermissionPolicy(value: unknown, fallback?: 'default' | 'legacy'): ManagedAgentPermissionPolicy;
|
|
3
69
|
export type AgentWorkspaceRoomLink = {
|
|
4
70
|
bindingId: string;
|
|
5
71
|
status: string;
|
|
@@ -45,6 +111,10 @@ export type AgentWorkspace = {
|
|
|
45
111
|
modelId: string | null;
|
|
46
112
|
sessionMode: SessionMode;
|
|
47
113
|
managerConfig: ManagerConfig | null;
|
|
114
|
+
/** Optional only for wire/cache compatibility. New servers always return an explicit policy. */
|
|
115
|
+
permissionPolicy?: ManagedAgentPermissionPolicy;
|
|
116
|
+
/** Null means this policy/runtime has no persisted high-risk or limited-protection approval. */
|
|
117
|
+
permissionConfirmation?: ManagedAgentPermissionConfirmation | null;
|
|
48
118
|
createdAt: string;
|
|
49
119
|
updatedAt: string;
|
|
50
120
|
sessions: AgentWorkspaceSession[];
|
|
@@ -1,2 +1,112 @@
|
|
|
1
1
|
// @arch docs/features/agent-workspaces.md
|
|
2
|
-
|
|
2
|
+
// @arch docs/features/managed-agent-restricted-runtime.md
|
|
3
|
+
export const MANAGED_AGENT_PERMISSION_POLICY_VERSION = 1;
|
|
4
|
+
export const DEFAULT_MANAGED_AGENT_PERMISSION_POLICY = {
|
|
5
|
+
version: MANAGED_AGENT_PERMISSION_POLICY_VERSION,
|
|
6
|
+
fileAccess: 'workspace-write',
|
|
7
|
+
externalCapabilities: {
|
|
8
|
+
commandNetwork: false,
|
|
9
|
+
webSearch: false,
|
|
10
|
+
browser: false,
|
|
11
|
+
computerUse: false,
|
|
12
|
+
mcp: false,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Compatibility projection for payloads created before managed permissions existed.
|
|
17
|
+
* Missing policy data must never be presented as if a restrictive sandbox were active.
|
|
18
|
+
*/
|
|
19
|
+
export const LEGACY_MANAGED_AGENT_PERMISSION_POLICY = {
|
|
20
|
+
version: MANAGED_AGENT_PERMISSION_POLICY_VERSION,
|
|
21
|
+
fileAccess: 'host-full',
|
|
22
|
+
externalCapabilities: {
|
|
23
|
+
commandNetwork: true,
|
|
24
|
+
webSearch: true,
|
|
25
|
+
browser: true,
|
|
26
|
+
computerUse: true,
|
|
27
|
+
mcp: true,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Project the policy the runtime can actually guarantee. Missing directional
|
|
32
|
+
* evidence is treated as possible host-wide file and external access.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveManagedAgentEffectivePermissionPolicy(requested, protection) {
|
|
35
|
+
const matrix = protection?.capabilityMatrix;
|
|
36
|
+
if (!matrix) {
|
|
37
|
+
return {
|
|
38
|
+
version: requested.version,
|
|
39
|
+
fileAccess: 'host-full',
|
|
40
|
+
externalCapabilities: {
|
|
41
|
+
commandNetwork: true,
|
|
42
|
+
webSearch: true,
|
|
43
|
+
browser: true,
|
|
44
|
+
computerUse: true,
|
|
45
|
+
mcp: true,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const fileAccess = matrix.fileAccess[requested.fileAccess]
|
|
50
|
+
? requested.fileAccess
|
|
51
|
+
: matrix.fileAccess['host-full']
|
|
52
|
+
? 'host-full'
|
|
53
|
+
: requested.fileAccess;
|
|
54
|
+
const externalCapabilities = { ...requested.externalCapabilities };
|
|
55
|
+
for (const capability of Object.keys(externalCapabilities)) {
|
|
56
|
+
if (!externalCapabilities[capability] && !matrix.externalCapabilities[capability].deny) {
|
|
57
|
+
externalCapabilities[capability] = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return { version: requested.version, fileAccess, externalCapabilities };
|
|
61
|
+
}
|
|
62
|
+
function copyManagedAgentPermissionPolicy(policy) {
|
|
63
|
+
return {
|
|
64
|
+
...policy,
|
|
65
|
+
externalCapabilities: { ...policy.externalCapabilities },
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Strictly parse an explicit policy. Invalid or incomplete values are not silently repaired. */
|
|
69
|
+
export function parseManagedAgentPermissionPolicy(value) {
|
|
70
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
71
|
+
return null;
|
|
72
|
+
const policy = value;
|
|
73
|
+
if (!Number.isSafeInteger(policy.version) || Number(policy.version) < 1)
|
|
74
|
+
return null;
|
|
75
|
+
if (policy.fileAccess !== 'workspace-read' &&
|
|
76
|
+
policy.fileAccess !== 'workspace-write' &&
|
|
77
|
+
policy.fileAccess !== 'host-full') {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
if (!policy.externalCapabilities ||
|
|
81
|
+
typeof policy.externalCapabilities !== 'object' ||
|
|
82
|
+
Array.isArray(policy.externalCapabilities)) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const capabilities = policy.externalCapabilities;
|
|
86
|
+
if (typeof capabilities.commandNetwork !== 'boolean' ||
|
|
87
|
+
typeof capabilities.webSearch !== 'boolean' ||
|
|
88
|
+
typeof capabilities.browser !== 'boolean' ||
|
|
89
|
+
typeof capabilities.computerUse !== 'boolean' ||
|
|
90
|
+
typeof capabilities.mcp !== 'boolean') {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
version: Number(policy.version),
|
|
95
|
+
fileAccess: policy.fileAccess,
|
|
96
|
+
externalCapabilities: {
|
|
97
|
+
commandNetwork: capabilities.commandNetwork,
|
|
98
|
+
webSearch: capabilities.webSearch,
|
|
99
|
+
browser: capabilities.browser,
|
|
100
|
+
computerUse: capabilities.computerUse,
|
|
101
|
+
mcp: capabilities.mcp,
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function resolveManagedAgentPermissionPolicy(value, fallback = 'legacy') {
|
|
106
|
+
const parsed = parseManagedAgentPermissionPolicy(value);
|
|
107
|
+
if (parsed)
|
|
108
|
+
return parsed;
|
|
109
|
+
return copyManagedAgentPermissionPolicy(fallback === 'default'
|
|
110
|
+
? DEFAULT_MANAGED_AGENT_PERMISSION_POLICY
|
|
111
|
+
: LEGACY_MANAGED_AGENT_PERMISSION_POLICY);
|
|
112
|
+
}
|
|
@@ -24,6 +24,8 @@ export type Machine = {
|
|
|
24
24
|
sessionSyncCapabilities?: import('./session-sync.ts').SessionSyncCapability[];
|
|
25
25
|
/** Auto-upgrade policy configured on this machine */
|
|
26
26
|
autoUpgrade?: AutoUpgradePolicy;
|
|
27
|
+
/** Set only after the daemon durably disables remote access on the machine. */
|
|
28
|
+
remoteAccessDisabledAt?: string | null;
|
|
27
29
|
/** Ownership role — absent means owner (backward-compatible) */
|
|
28
30
|
role?: 'owner' | 'granted';
|
|
29
31
|
/** Non-null only when role === 'granted' */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type ReqMethod = 'chat.send' | 'chat.enqueue' | 'chat.queue.get' | 'chat.queue.edit' | 'chat.queue.delete' | 'chat.abort' | 'session.resume' | 'session.history' | 'session.history.open' | 'session.history.sync' | 'session.history.page' | 'session.history.close' | 'session.index.update' | 'session.deletions.sync' | 'session.deletions.ack' | 'session.message.status' | 'voice.session.body.window' | 'session.refresh' | 'session.tool.detail' | 'session.title.set' | 'session.title.generate' | 'fs.ls' | 'fs.read' | 'fs.write' | 'fs.export.markdown-pdf' | 'fs.export.markdown-pdf.setup' | 'fs.archive.zip' | 'fs.transfer.start' | 'fs.transfer.chunk' | 'fs.transfer.finish' | 'fs.transfer.abort' | 'fs.rename' | 'skill.list' | 'skill.install' | 'skill.doctor' | 'skill.setup' | 'skill.use' | 'region.probe' | 'region.switch' | 'upgrade.start' | 'upgrade.status' | 'upgrade.set-policy' | 'agents.refresh' | 'models.refresh' | 'agent.config.get' | 'agent.config.upsert' | 'agent.config.clear' | 'agent.config.test' | 'agent.capabilities.list' | 'manager.channel.get' | 'manager.channel.upsert' | 'session.wechat-rpa.channel.get' | 'session.wechat-rpa.channel.upsert' | 'session.wechat-rpa.channel.sync' | 'session.wechat-rpa.outbound.cancel' | 'manager.wechat-rpa.channel.get' | 'manager.wechat-rpa.channel.upsert' | 'manager.wechat-rpa.channel.sync' | 'manager.wechat-rpa.outbound.cancel' | 'wechat-rpa.helper.runtime' | 'wecom.send' | 'external.send' | 'room.sync' | 'room.send' | 'room.bind' | 'room.agent.bind-managed' | 'room.agent.restart-managed' | 'room.unbind';
|
|
1
|
+
export type ReqMethod = 'chat.send' | 'chat.enqueue' | 'chat.queue.get' | 'chat.queue.edit' | 'chat.queue.delete' | 'chat.abort' | 'session.resume' | 'session.history' | 'session.history.open' | 'session.history.sync' | 'session.history.page' | 'session.history.close' | 'session.body.replica.subscribe' | 'session.body.replica.unsubscribe' | 'session.index.update' | 'session.deletions.sync' | 'session.deletions.ack' | 'session.message.status' | 'voice.session.body.window' | 'session.refresh' | 'session.tool.detail' | 'session.title.set' | 'session.title.generate' | 'fs.ls' | 'fs.read' | 'fs.write' | 'fs.export.markdown-pdf' | 'fs.export.markdown-pdf.setup' | 'fs.archive.zip' | 'fs.transfer.start' | 'fs.transfer.chunk' | 'fs.transfer.finish' | 'fs.transfer.abort' | 'fs.rename' | 'skill.list' | 'skill.install' | 'skill.doctor' | 'skill.setup' | 'skill.use' | 'region.probe' | 'region.switch' | 'upgrade.start' | 'upgrade.status' | 'upgrade.set-policy' | 'machine.remote-access.pause' | 'agents.refresh' | 'models.refresh' | 'agent.config.get' | 'agent.config.upsert' | 'agent.config.clear' | 'agent.config.test' | 'agent.capabilities.list' | 'manager.channel.get' | 'manager.channel.upsert' | 'session.wechat-rpa.channel.get' | 'session.wechat-rpa.channel.upsert' | 'session.wechat-rpa.channel.sync' | 'session.wechat-rpa.outbound.cancel' | 'manager.wechat-rpa.channel.get' | 'manager.wechat-rpa.channel.upsert' | 'manager.wechat-rpa.channel.sync' | 'manager.wechat-rpa.outbound.cancel' | 'wechat-rpa.helper.runtime' | 'wecom.send' | 'external.send' | 'room.sync' | 'room.send' | 'room.bind' | 'room.agent.bind-managed' | 'room.agent.restart-managed' | 'room.unbind';
|
|
@@ -21,9 +21,9 @@ export declare const SESSION_SYNC_REQUIRED_CAPABILITIES: readonly ["session_inde
|
|
|
21
21
|
* epoch-wide minimum gate. This lets the App roll out background replication
|
|
22
22
|
* while old daemons keep serving the compatible visible-session snapshot path.
|
|
23
23
|
*/
|
|
24
|
-
export declare const SESSION_SYNC_ADDITIVE_CAPABILITIES: readonly ["session_body_replica_v1"];
|
|
25
|
-
export declare const SESSION_SYNC_ADVERTISED_CAPABILITIES: readonly ["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", "session_body_replica_v1"];
|
|
26
|
-
export declare const SESSION_SYNC_EVENT_NAMES: readonly ["session.index.updated", "session.body.delta"];
|
|
24
|
+
export declare const SESSION_SYNC_ADDITIVE_CAPABILITIES: readonly ["session_body_replica_v1", "session_body_replica_stream_v1"];
|
|
25
|
+
export declare const SESSION_SYNC_ADVERTISED_CAPABILITIES: readonly ["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", "session_body_replica_v1", "session_body_replica_stream_v1"];
|
|
26
|
+
export declare const SESSION_SYNC_EVENT_NAMES: readonly ["session.index.updated", "session.body.delta", "session.body.replica.delta", "session.body.replica.error"];
|
|
27
27
|
export declare const SESSION_HISTORY_LIMITS: {
|
|
28
28
|
readonly defaultSnapshotMessages: 100;
|
|
29
29
|
readonly maxSnapshotMessages: 500;
|
|
@@ -34,6 +34,7 @@ export declare const SESSION_HISTORY_LIMITS: {
|
|
|
34
34
|
readonly maxReplicaPageBytes: number;
|
|
35
35
|
readonly maxSubscriptionsPerClient: 4;
|
|
36
36
|
readonly maxSubscriptionsPerSession: 8;
|
|
37
|
+
readonly maxReplicaStreamsPerDaemon: 8;
|
|
37
38
|
};
|
|
38
39
|
export type SessionSyncCapability = (typeof SESSION_SYNC_ADVERTISED_CAPABILITIES)[number];
|
|
39
40
|
export type SessionSyncEventName = (typeof SESSION_SYNC_EVENT_NAMES)[number];
|
|
@@ -257,6 +258,55 @@ export type SessionHistorySyncPage = PersonalSyncIdentity & {
|
|
|
257
258
|
hasMore: boolean;
|
|
258
259
|
mutations: SessionBodyMutation[];
|
|
259
260
|
};
|
|
261
|
+
/**
|
|
262
|
+
* One foreground App installation owns at most one body replica stream for a
|
|
263
|
+
* daemon generation. The daemon registers the stream before capturing these
|
|
264
|
+
* high-water marks, so mutations committed during subscribe cannot be lost.
|
|
265
|
+
*/
|
|
266
|
+
export type SessionBodyReplicaSubscribeParams = PersonalSyncIdentity & {
|
|
267
|
+
appInstallationId: string;
|
|
268
|
+
streamId: string;
|
|
269
|
+
generation: number;
|
|
270
|
+
};
|
|
271
|
+
export type SessionBodyReplicaHighWater = {
|
|
272
|
+
sessionId: string;
|
|
273
|
+
bodyRevision: number;
|
|
274
|
+
};
|
|
275
|
+
export type SessionBodyReplicaSubscribeResponse = PersonalSyncIdentity & {
|
|
276
|
+
appInstallationId: string;
|
|
277
|
+
streamId: string;
|
|
278
|
+
generation: number;
|
|
279
|
+
highWatermarks: SessionBodyReplicaHighWater[];
|
|
280
|
+
};
|
|
281
|
+
export type SessionBodyReplicaUnsubscribeParams = PersonalSyncIdentity & {
|
|
282
|
+
appInstallationId: string;
|
|
283
|
+
streamId: string;
|
|
284
|
+
generation: number;
|
|
285
|
+
};
|
|
286
|
+
export type SessionBodyReplicaUnsubscribeResponse = PersonalSyncIdentity & {
|
|
287
|
+
appInstallationId: string;
|
|
288
|
+
streamId: string;
|
|
289
|
+
generation: number;
|
|
290
|
+
closed: true;
|
|
291
|
+
};
|
|
292
|
+
export type SessionBodyReplicaDeltaBatch = {
|
|
293
|
+
sessionId: string;
|
|
294
|
+
fromRevision: number;
|
|
295
|
+
toRevision: number;
|
|
296
|
+
mutations: SessionBodyMutation[];
|
|
297
|
+
};
|
|
298
|
+
export type SessionBodyReplicaDeltaEvent = PersonalSyncIdentity & {
|
|
299
|
+
appInstallationId: string;
|
|
300
|
+
streamId: string;
|
|
301
|
+
generation: number;
|
|
302
|
+
batches: SessionBodyReplicaDeltaBatch[];
|
|
303
|
+
};
|
|
304
|
+
export type SessionBodyReplicaErrorEvent = {
|
|
305
|
+
streamId: string;
|
|
306
|
+
generation?: number;
|
|
307
|
+
appInstallationId?: string;
|
|
308
|
+
rejection: SessionSyncRejection;
|
|
309
|
+
};
|
|
260
310
|
/**
|
|
261
311
|
* Machine-authored personal-session projection. Ownership, machine display
|
|
262
312
|
* fields and viewer permissions are server authority and therefore never
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @arch docs/architecture/data-sync.md
|
|
1
|
+
// @arch docs/architecture/data-sync.md#8-app-级统一正文副本与列表发布屏障
|
|
2
2
|
// @test src/__tests__/session-sync.test.ts
|
|
3
3
|
export const SESSION_SYNC_PROTOCOL_VERSION = 2;
|
|
4
4
|
/**
|
|
@@ -37,6 +37,7 @@ export const SESSION_SYNC_REQUIRED_CAPABILITIES = [
|
|
|
37
37
|
*/
|
|
38
38
|
export const SESSION_SYNC_ADDITIVE_CAPABILITIES = [
|
|
39
39
|
'session_body_replica_v1',
|
|
40
|
+
'session_body_replica_stream_v1',
|
|
40
41
|
];
|
|
41
42
|
export const SESSION_SYNC_ADVERTISED_CAPABILITIES = [
|
|
42
43
|
...SESSION_SYNC_REQUIRED_CAPABILITIES,
|
|
@@ -45,6 +46,8 @@ export const SESSION_SYNC_ADVERTISED_CAPABILITIES = [
|
|
|
45
46
|
export const SESSION_SYNC_EVENT_NAMES = [
|
|
46
47
|
'session.index.updated',
|
|
47
48
|
'session.body.delta',
|
|
49
|
+
'session.body.replica.delta',
|
|
50
|
+
'session.body.replica.error',
|
|
48
51
|
];
|
|
49
52
|
export const SESSION_HISTORY_LIMITS = {
|
|
50
53
|
defaultSnapshotMessages: 100,
|
|
@@ -56,6 +59,7 @@ export const SESSION_HISTORY_LIMITS = {
|
|
|
56
59
|
maxReplicaPageBytes: 4 * 1024 * 1024,
|
|
57
60
|
maxSubscriptionsPerClient: 4,
|
|
58
61
|
maxSubscriptionsPerSession: 8,
|
|
62
|
+
maxReplicaStreamsPerDaemon: 8,
|
|
59
63
|
};
|
|
60
64
|
export const SESSION_TITLE_SOURCE_PRIORITY = {
|
|
61
65
|
first_user_fallback: 0,
|
|
@@ -56,6 +56,8 @@ export type AgentInfo = {
|
|
|
56
56
|
config?: AgentConfigSummary;
|
|
57
57
|
/** Non-secret runtime version and compatibility summary. */
|
|
58
58
|
runtime?: AgentRuntimeSummary;
|
|
59
|
+
/** Conservative per-machine protection baseline; absent on older daemons. */
|
|
60
|
+
managedAgentProtection?: import('./agent-workspace.ts').ManagedAgentRuntimeProtection;
|
|
59
61
|
};
|
|
60
62
|
export type SessionMode = 'standard' | 'manager';
|
|
61
63
|
export type ManagerConfig = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shennian",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.74",
|
|
4
4
|
"description": "Shennian — AI Agent Control Plane CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsc && node -e \"require('node:fs').chmodSync('dist/bin/shennian.js', 0o755)\"",
|
|
59
59
|
"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",
|
|
60
|
+
"test:security:codex": "tsx scripts/verify-managed-codex-sandbox.ts",
|
|
61
|
+
"test:security:codex-tools": "tsx scripts/verify-managed-codex-dynamic-tools.ts",
|
|
60
62
|
"dev": "tsc --watch"
|
|
61
63
|
}
|
|
62
64
|
}
|