shennian 0.3.73 → 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.
Files changed (89) hide show
  1. package/dist/publish-build-manifest.json +122 -57
  2. package/dist/src/agent-env.d.ts +30 -0
  3. package/dist/src/agent-env.js +4 -4
  4. package/dist/src/agents/adapter.d.ts +5 -0
  5. package/dist/src/agents/claude-managed-permissions.d.ts +33 -0
  6. package/dist/src/agents/claude-managed-permissions.js +1 -0
  7. package/dist/src/agents/claude.d.ts +11 -2
  8. package/dist/src/agents/claude.js +5 -5
  9. package/dist/src/agents/codex-managed-permissions.d.ts +32 -0
  10. package/dist/src/agents/codex-managed-permissions.js +1 -0
  11. package/dist/src/agents/codex-managed-room-tools.d.ts +40 -0
  12. package/dist/src/agents/codex-managed-room-tools.js +1 -0
  13. package/dist/src/agents/codex.d.ts +20 -2
  14. package/dist/src/agents/codex.js +11 -10
  15. package/dist/src/agents/command-spec.d.ts +8 -0
  16. package/dist/src/agents/command-spec.js +3 -2
  17. package/dist/src/agents/cursor-managed-permissions.d.ts +28 -0
  18. package/dist/src/agents/cursor-managed-permissions.js +2 -0
  19. package/dist/src/agents/cursor.d.ts +8 -2
  20. package/dist/src/agents/cursor.js +1 -1
  21. package/dist/src/agents/custom-managed-runtime.d.ts +37 -0
  22. package/dist/src/agents/custom-managed-runtime.js +2 -0
  23. package/dist/src/agents/custom.d.ts +12 -2
  24. package/dist/src/agents/custom.js +4 -4
  25. package/dist/src/agents/detect.d.ts +3 -0
  26. package/dist/src/agents/detect.js +1 -1
  27. package/dist/src/agents/model-registry/service.js +1 -1
  28. package/dist/src/agents/opencode-managed-permissions.d.ts +25 -0
  29. package/dist/src/agents/opencode-managed-permissions.js +2 -0
  30. package/dist/src/agents/opencode.d.ts +8 -2
  31. package/dist/src/agents/opencode.js +1 -1
  32. package/dist/src/agents/workbuddy-managed-permissions.d.ts +37 -0
  33. package/dist/src/agents/workbuddy-managed-permissions.js +2 -0
  34. package/dist/src/agents/workbuddy.d.ts +8 -0
  35. package/dist/src/agents/workbuddy.js +2 -2
  36. package/dist/src/commands/daemon.d.ts +29 -0
  37. package/dist/src/commands/daemon.js +14 -14
  38. package/dist/src/commands/room.js +3 -3
  39. package/dist/src/commands/runtime.js +5 -5
  40. package/dist/src/config/index.d.ts +22 -0
  41. package/dist/src/daemon-ipc/paths.d.ts +8 -0
  42. package/dist/src/daemon-ipc/paths.js +1 -1
  43. package/dist/src/index.js +3 -3
  44. package/dist/src/log-redaction.d.ts +4 -0
  45. package/dist/src/log-redaction.js +1 -0
  46. package/dist/src/relay/client.d.ts +1 -0
  47. package/dist/src/relay/client.js +1 -1
  48. package/dist/src/room/activation-service.d.ts +23 -1
  49. package/dist/src/room/activation-service.js +7 -7
  50. package/dist/src/room/attachment-cache.d.ts +3 -0
  51. package/dist/src/room/attachment-cache.js +2 -2
  52. package/dist/src/room/attachment-upload.js +1 -1
  53. package/dist/src/room/managed-prompt-composer.d.ts +16 -3
  54. package/dist/src/room/managed-prompt-composer.js +26 -13
  55. package/dist/src/room/managed-room-binding.d.ts +3 -3
  56. package/dist/src/room/managed-room-binding.js +1 -1
  57. package/dist/src/room/managed-room-ipc.d.ts +32 -0
  58. package/dist/src/room/managed-room-ipc.js +3 -1
  59. package/dist/src/room/room-action-client.d.ts +5 -1
  60. package/dist/src/room/room-action-client.js +1 -1
  61. package/dist/src/security/managed-agent-credential-paths.d.ts +6 -0
  62. package/dist/src/security/managed-agent-credential-paths.js +1 -0
  63. package/dist/src/security/managed-agent-executable.d.ts +19 -0
  64. package/dist/src/security/managed-agent-executable.js +1 -0
  65. package/dist/src/security/managed-agent-policy.d.ts +55 -0
  66. package/dist/src/security/managed-agent-policy.js +1 -0
  67. package/dist/src/security/managed-agent-runtime.d.ts +44 -0
  68. package/dist/src/security/managed-agent-runtime.js +1 -0
  69. package/dist/src/session/handlers/chat.d.ts +8 -1
  70. package/dist/src/session/handlers/chat.js +2 -2
  71. package/dist/src/session/handlers/remote-access.d.ts +4 -0
  72. package/dist/src/session/handlers/remote-access.js +1 -0
  73. package/dist/src/session/handlers/room-managed.d.ts +1 -1
  74. package/dist/src/session/handlers/room-managed.js +1 -1
  75. package/dist/src/session/history-subscriptions.d.ts +6 -0
  76. package/dist/src/session/history-subscriptions.js +1 -1
  77. package/dist/src/session/manager.d.ts +7 -2
  78. package/dist/src/session/manager.js +1 -1
  79. package/dist/src/session/queue.d.ts +4 -0
  80. package/dist/src/session/queue.js +4 -4
  81. package/dist/src/session/types.d.ts +14 -0
  82. package/node_modules/@shennian/wire/dist/agent-workspace.d.ts +70 -0
  83. package/node_modules/@shennian/wire/dist/agent-workspace.js +111 -1
  84. package/node_modules/@shennian/wire/dist/machine.d.ts +2 -0
  85. package/node_modules/@shennian/wire/dist/methods.d.ts +1 -1
  86. package/node_modules/@shennian/wire/dist/session-sync.d.ts +53 -3
  87. package/node_modules/@shennian/wire/dist/session-sync.js +5 -1
  88. package/node_modules/@shennian/wire/dist/session.d.ts +2 -0
  89. package/package.json +3 -1
@@ -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#目标架构-v3
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.73",
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
  }