shennian 0.3.37 → 0.3.39

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 (214) hide show
  1. package/README.md +1 -0
  2. package/dist/publish-build-manifest.json +73 -168
  3. package/dist/src/agents/detect.js +1 -1
  4. package/dist/src/agents/manager.d.ts +36 -0
  5. package/dist/src/agents/manager.js +11 -6
  6. package/dist/src/agents/model-registry/service.js +1 -1
  7. package/dist/src/agents/workbuddy.js +2 -2
  8. package/dist/src/commands/agent.d.ts +6 -1
  9. package/dist/src/commands/agent.js +3 -6
  10. package/dist/src/commands/integration.d.ts +1 -0
  11. package/dist/src/commands/integration.js +2 -1
  12. package/dist/src/commands/manager.js +1 -1
  13. package/dist/src/commands/pair-authorization.d.ts +3 -0
  14. package/dist/src/commands/pair-authorization.js +1 -0
  15. package/dist/src/commands/pair-browser.js +1 -1
  16. package/dist/src/commands/room.d.ts +9 -17
  17. package/dist/src/commands/room.js +3 -8
  18. package/dist/src/commands/runtime.d.ts +2 -0
  19. package/dist/src/commands/runtime.js +6 -0
  20. package/dist/src/daemon-ipc/client.d.ts +1 -1
  21. package/dist/src/daemon-ipc/json.d.ts +3 -0
  22. package/dist/src/daemon-ipc/json.js +1 -0
  23. package/dist/src/daemon-ipc/protocol.d.ts +1 -1
  24. package/dist/src/daemon-ipc/server.d.ts +1 -1
  25. package/dist/src/index.js +3 -2
  26. package/dist/src/manager/registry.d.ts +21 -0
  27. package/dist/src/manager/registry.js +2 -2
  28. package/dist/src/manager/runtime.d.ts +5 -1
  29. package/dist/src/manager/runtime.js +14 -13
  30. package/dist/src/room/activation-service.d.ts +6 -0
  31. package/dist/src/room/activation-service.js +5 -8
  32. package/dist/src/room/attachment-cache.d.ts +2 -1
  33. package/dist/src/room/attachment-cache.js +2 -2
  34. package/dist/src/room/device-authorization-client.d.ts +39 -1
  35. package/dist/src/room/managed-context.d.ts +45 -0
  36. package/dist/src/room/managed-context.js +1 -0
  37. package/dist/src/room/managed-prompt-composer.d.ts +32 -0
  38. package/dist/src/room/managed-prompt-composer.js +24 -0
  39. package/dist/src/room/managed-room-ipc.d.ts +16 -0
  40. package/dist/src/room/managed-room-ipc.js +1 -0
  41. package/dist/src/room/mirror-sync-service.d.ts +2 -5
  42. package/dist/src/room/mirror-sync-service.js +1 -1
  43. package/dist/src/room/public-attachment-cache.d.ts +34 -0
  44. package/dist/src/room/public-attachment-cache.js +2 -0
  45. package/dist/src/room/public-room-client.d.ts +36 -0
  46. package/dist/src/room/public-room-client.js +1 -0
  47. package/dist/src/room/room-action-client.d.ts +3 -1
  48. package/dist/src/room/room-action-client.js +1 -1
  49. package/dist/src/room/session-registry.d.ts +7 -0
  50. package/dist/src/room/session-registry.js +2 -2
  51. package/dist/src/session/handlers/chat.d.ts +5 -1
  52. package/dist/src/session/handlers/chat.js +2 -2
  53. package/dist/src/session/manager.d.ts +1 -20
  54. package/dist/src/session/manager.js +1 -1
  55. package/dist/src/session/queue.js +3 -3
  56. package/dist/src/session/store.d.ts +9 -1
  57. package/dist/src/session/store.js +3 -3
  58. package/dist/src/session/types.d.ts +2 -1
  59. package/node_modules/@shennian/wire/dist/agent-capabilities.d.ts +0 -1
  60. package/node_modules/@shennian/wire/dist/agent-capabilities.js +0 -1
  61. package/node_modules/@shennian/wire/dist/agent-workspace.d.ts +0 -1
  62. package/node_modules/@shennian/wire/dist/agent-workspace.js +0 -1
  63. package/node_modules/@shennian/wire/dist/envelope.d.ts +0 -1
  64. package/node_modules/@shennian/wire/dist/envelope.js +0 -1
  65. package/node_modules/@shennian/wire/dist/events.d.ts +0 -1
  66. package/node_modules/@shennian/wire/dist/events.js +0 -1
  67. package/node_modules/@shennian/wire/dist/external-message-format.d.ts +0 -1
  68. package/node_modules/@shennian/wire/dist/external-message-format.js +0 -1
  69. package/node_modules/@shennian/wire/dist/frames.d.ts +0 -1
  70. package/node_modules/@shennian/wire/dist/frames.js +0 -1
  71. package/node_modules/@shennian/wire/dist/fs.d.ts +0 -1
  72. package/node_modules/@shennian/wire/dist/fs.js +0 -1
  73. package/node_modules/@shennian/wire/dist/index.d.ts +0 -1
  74. package/node_modules/@shennian/wire/dist/index.js +0 -1
  75. package/node_modules/@shennian/wire/dist/machine.d.ts +0 -1
  76. package/node_modules/@shennian/wire/dist/machine.js +0 -1
  77. package/node_modules/@shennian/wire/dist/message-payload.d.ts +0 -1
  78. package/node_modules/@shennian/wire/dist/message-payload.js +0 -1
  79. package/node_modules/@shennian/wire/dist/methods.d.ts +0 -1
  80. package/node_modules/@shennian/wire/dist/methods.js +0 -1
  81. package/node_modules/@shennian/wire/dist/native-session.d.ts +0 -1
  82. package/node_modules/@shennian/wire/dist/native-session.js +0 -1
  83. package/node_modules/@shennian/wire/dist/project.d.ts +0 -1
  84. package/node_modules/@shennian/wire/dist/project.js +0 -1
  85. package/node_modules/@shennian/wire/dist/room.d.ts +44 -1
  86. package/node_modules/@shennian/wire/dist/room.js +0 -1
  87. package/node_modules/@shennian/wire/dist/session.d.ts +18 -3
  88. package/node_modules/@shennian/wire/dist/session.js +0 -2
  89. package/node_modules/@shennian/wire/dist/tool-detail.d.ts +0 -1
  90. package/node_modules/@shennian/wire/dist/tool-detail.js +0 -1
  91. package/node_modules/@shennian/wire/dist/voice-chief.d.ts +0 -1
  92. package/node_modules/@shennian/wire/dist/voice-chief.js +0 -1
  93. package/node_modules/@shennian/wire/package.json +1 -0
  94. package/package.json +2 -2
  95. package/dist/src/integrations/claude-room-plugin-lifecycle.d.ts +0 -47
  96. package/dist/src/integrations/claude-room-plugin-lifecycle.js +0 -1
  97. package/dist/src/integrations/codex-room-plugin-lifecycle.d.ts +0 -49
  98. package/dist/src/integrations/codex-room-plugin-lifecycle.js +0 -1
  99. package/dist/src/integrations/room-plugin-bundles.d.ts +0 -23
  100. package/dist/src/integrations/room-plugin-bundles.js +0 -1
  101. package/dist/src/integrations/room-plugin-lifecycle-common.d.ts +0 -17
  102. package/dist/src/integrations/room-plugin-lifecycle-common.js +0 -1
  103. package/dist/src/integrations/room-plugin-shared.d.ts +0 -24
  104. package/dist/src/integrations/room-plugin-shared.js +0 -38
  105. package/dist/src/integrations/room-session-hook.d.ts +0 -30
  106. package/dist/src/integrations/room-session-hook.js +0 -2
  107. package/dist/src/integrations/workbuddy-plugin-bundle.d.ts +0 -16
  108. package/dist/src/integrations/workbuddy-plugin-bundle.js +0 -1
  109. package/dist/src/integrations/workbuddy-plugin-lifecycle.d.ts +0 -62
  110. package/dist/src/integrations/workbuddy-plugin-lifecycle.js +0 -2
  111. package/dist/src/integrations/workbuddy-session-hook.d.ts +0 -22
  112. package/dist/src/integrations/workbuddy-session-hook.js +0 -1
  113. package/dist/src/room/agent-tool.d.ts +0 -63
  114. package/dist/src/room/agent-tool.js +0 -1
  115. package/dist/src/room/authorized-action-coordinator.d.ts +0 -40
  116. package/dist/src/room/authorized-action-coordinator.js +0 -1
  117. package/dist/src/room/authorized-action-ipc.d.ts +0 -11
  118. package/dist/src/room/authorized-action-ipc.js +0 -1
  119. package/dist/src/room/host-session-observation-ipc.d.ts +0 -9
  120. package/dist/src/room/host-session-observation-ipc.js +0 -1
  121. package/dist/src/room/invocation-token-ipc.d.ts +0 -9
  122. package/dist/src/room/invocation-token-ipc.js +0 -1
  123. package/dist/src/room/invocation-token.d.ts +0 -53
  124. package/dist/src/room/invocation-token.js +0 -1
  125. package/dist/src/room/jsonl-mirror.d.ts +0 -73
  126. package/dist/src/room/jsonl-mirror.js +0 -6
  127. package/dist/src/room/managed-room-session-runtime.d.ts +0 -18
  128. package/dist/src/room/managed-room-session-runtime.js +0 -1
  129. package/dist/src/room/managed-room-session.d.ts +0 -144
  130. package/dist/src/room/managed-room-session.js +0 -2
  131. package/dist/src/room/operator-ipc.d.ts +0 -13
  132. package/dist/src/room/operator-ipc.js +0 -1
  133. package/dist/src/room/pending-authorized-actions.d.ts +0 -69
  134. package/dist/src/room/pending-authorized-actions.js +0 -3
  135. package/dist/src/room/room-action-ipc.d.ts +0 -34
  136. package/dist/src/room/room-action-ipc.js +0 -1
  137. package/dist/src/room/room-action-schema.d.ts +0 -3
  138. package/dist/src/room/room-action-schema.js +0 -1
  139. package/dist/src/room/room-authorized-action-executor.d.ts +0 -23
  140. package/dist/src/room/room-authorized-action-executor.js +0 -1
  141. package/dist/src/room/room-binding-ipc.d.ts +0 -31
  142. package/dist/src/room/room-binding-ipc.js +0 -1
  143. package/dist/src/room/session-registry-ipc.d.ts +0 -14
  144. package/dist/src/room/session-registry-ipc.js +0 -1
  145. package/dist/src/room/tool-schema.d.ts +0 -120
  146. package/dist/src/room/tool-schema.js +0 -1
  147. package/dist/src/room/tool-server.d.ts +0 -11
  148. package/dist/src/room/tool-server.js +0 -3
  149. package/node_modules/@shennian/wire/dist/__tests__/message-payload.test.d.ts +0 -2
  150. package/node_modules/@shennian/wire/dist/__tests__/message-payload.test.d.ts.map +0 -1
  151. package/node_modules/@shennian/wire/dist/__tests__/message-payload.test.js +0 -23
  152. package/node_modules/@shennian/wire/dist/__tests__/message-payload.test.js.map +0 -1
  153. package/node_modules/@shennian/wire/dist/__tests__/mock.test.d.ts +0 -2
  154. package/node_modules/@shennian/wire/dist/__tests__/mock.test.d.ts.map +0 -1
  155. package/node_modules/@shennian/wire/dist/__tests__/mock.test.js +0 -66
  156. package/node_modules/@shennian/wire/dist/__tests__/mock.test.js.map +0 -1
  157. package/node_modules/@shennian/wire/dist/__tests__/types.test.d.ts +0 -2
  158. package/node_modules/@shennian/wire/dist/__tests__/types.test.d.ts.map +0 -1
  159. package/node_modules/@shennian/wire/dist/__tests__/types.test.js +0 -159
  160. package/node_modules/@shennian/wire/dist/__tests__/types.test.js.map +0 -1
  161. package/node_modules/@shennian/wire/dist/agent-capabilities.d.ts.map +0 -1
  162. package/node_modules/@shennian/wire/dist/agent-capabilities.js.map +0 -1
  163. package/node_modules/@shennian/wire/dist/agent-workspace.d.ts.map +0 -1
  164. package/node_modules/@shennian/wire/dist/agent-workspace.js.map +0 -1
  165. package/node_modules/@shennian/wire/dist/envelope.d.ts.map +0 -1
  166. package/node_modules/@shennian/wire/dist/envelope.js.map +0 -1
  167. package/node_modules/@shennian/wire/dist/events.d.ts.map +0 -1
  168. package/node_modules/@shennian/wire/dist/events.js.map +0 -1
  169. package/node_modules/@shennian/wire/dist/external-message-format.d.ts.map +0 -1
  170. package/node_modules/@shennian/wire/dist/external-message-format.js.map +0 -1
  171. package/node_modules/@shennian/wire/dist/frames.d.ts.map +0 -1
  172. package/node_modules/@shennian/wire/dist/frames.js.map +0 -1
  173. package/node_modules/@shennian/wire/dist/fs.d.ts.map +0 -1
  174. package/node_modules/@shennian/wire/dist/fs.js.map +0 -1
  175. package/node_modules/@shennian/wire/dist/index.d.ts.map +0 -1
  176. package/node_modules/@shennian/wire/dist/index.js.map +0 -1
  177. package/node_modules/@shennian/wire/dist/machine.d.ts.map +0 -1
  178. package/node_modules/@shennian/wire/dist/machine.js.map +0 -1
  179. package/node_modules/@shennian/wire/dist/message-payload.d.ts.map +0 -1
  180. package/node_modules/@shennian/wire/dist/message-payload.js.map +0 -1
  181. package/node_modules/@shennian/wire/dist/methods.d.ts.map +0 -1
  182. package/node_modules/@shennian/wire/dist/methods.js.map +0 -1
  183. package/node_modules/@shennian/wire/dist/mock/fixtures.d.ts +0 -39
  184. package/node_modules/@shennian/wire/dist/mock/fixtures.d.ts.map +0 -1
  185. package/node_modules/@shennian/wire/dist/mock/fixtures.js +0 -99
  186. package/node_modules/@shennian/wire/dist/mock/fixtures.js.map +0 -1
  187. package/node_modules/@shennian/wire/dist/mock/index.d.ts +0 -3
  188. package/node_modules/@shennian/wire/dist/mock/index.d.ts.map +0 -1
  189. package/node_modules/@shennian/wire/dist/mock/index.js +0 -4
  190. package/node_modules/@shennian/wire/dist/mock/index.js.map +0 -1
  191. package/node_modules/@shennian/wire/dist/mock/routes.d.ts +0 -96
  192. package/node_modules/@shennian/wire/dist/mock/routes.d.ts.map +0 -1
  193. package/node_modules/@shennian/wire/dist/mock/routes.js +0 -40
  194. package/node_modules/@shennian/wire/dist/mock/routes.js.map +0 -1
  195. package/node_modules/@shennian/wire/dist/native-session.d.ts.map +0 -1
  196. package/node_modules/@shennian/wire/dist/native-session.js.map +0 -1
  197. package/node_modules/@shennian/wire/dist/project.d.ts.map +0 -1
  198. package/node_modules/@shennian/wire/dist/project.js.map +0 -1
  199. package/node_modules/@shennian/wire/dist/queue.d.ts +0 -15
  200. package/node_modules/@shennian/wire/dist/queue.d.ts.map +0 -1
  201. package/node_modules/@shennian/wire/dist/queue.js +0 -2
  202. package/node_modules/@shennian/wire/dist/queue.js.map +0 -1
  203. package/node_modules/@shennian/wire/dist/room.d.ts.map +0 -1
  204. package/node_modules/@shennian/wire/dist/room.js.map +0 -1
  205. package/node_modules/@shennian/wire/dist/session.d.ts.map +0 -1
  206. package/node_modules/@shennian/wire/dist/session.js.map +0 -1
  207. package/node_modules/@shennian/wire/dist/skills.d.ts +0 -61
  208. package/node_modules/@shennian/wire/dist/skills.d.ts.map +0 -1
  209. package/node_modules/@shennian/wire/dist/skills.js +0 -2
  210. package/node_modules/@shennian/wire/dist/skills.js.map +0 -1
  211. package/node_modules/@shennian/wire/dist/tool-detail.d.ts.map +0 -1
  212. package/node_modules/@shennian/wire/dist/tool-detail.js.map +0 -1
  213. package/node_modules/@shennian/wire/dist/voice-chief.d.ts.map +0 -1
  214. package/node_modules/@shennian/wire/dist/voice-chief.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { AgentType, ExternalChannelSessionStatus, SessionRunPhase } from '@shennian/wire';
1
+ import type { AgentType, ExternalChannelSessionStatus, SessionMode, SessionRunPhase } from '@shennian/wire';
2
2
  import type { AgentAdapter } from '../agents/adapter.js';
3
3
  import type { CliRelayClient } from '../relay/client.js';
4
4
  import type { NativeSessionFusionService } from '../native-fusion/service.js';
@@ -8,6 +8,7 @@ export type ActiveSession = {
8
8
  adapter: AgentAdapter;
9
9
  workDir: string;
10
10
  agentType: AgentType;
11
+ sessionMode?: SessionMode;
11
12
  agentSessionId: string | null;
12
13
  lastActiveAt: number;
13
14
  currentRunId: string | null;
@@ -14,4 +14,3 @@ export type AgentCapabilitiesListPayload = {
14
14
  agentType: string;
15
15
  capabilities: AgentNativeCapability[];
16
16
  };
17
- //# sourceMappingURL=agent-capabilities.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=agent-capabilities.js.map
@@ -41,4 +41,3 @@ export type AgentWorkspace = {
41
41
  updatedAt: string;
42
42
  sessions: AgentWorkspaceSession[];
43
43
  };
44
- //# sourceMappingURL=agent-workspace.d.ts.map
@@ -1,3 +1,2 @@
1
1
  // @arch docs/features/agent-workspaces.md
2
2
  export {};
3
- //# sourceMappingURL=agent-workspace.js.map
@@ -5,4 +5,3 @@ export type Envelope = {
5
5
  ts: number;
6
6
  payload: string;
7
7
  };
8
- //# sourceMappingURL=envelope.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=envelope.js.map
@@ -90,4 +90,3 @@ export type AgentEventPayload = {
90
90
  sessionId: string;
91
91
  total: number;
92
92
  };
93
- //# sourceMappingURL=events.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=events.js.map
@@ -35,4 +35,3 @@ export declare function formatExternalConversationText(input: {
35
35
  messages: ExternalMessageFormatMessage[];
36
36
  includeContextLabel?: boolean;
37
37
  }): string;
38
- //# sourceMappingURL=external-message-format.d.ts.map
@@ -68,4 +68,3 @@ export function formatExternalConversationText(input) {
68
68
  .filter(Boolean);
69
69
  return [...header, ...body].join('\n');
70
70
  }
71
- //# sourceMappingURL=external-message-format.js.map
@@ -28,4 +28,3 @@ export type RoutedFrame = {
28
28
  machineId: string;
29
29
  frame: Frame;
30
30
  };
31
- //# sourceMappingURL=frames.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=frames.js.map
@@ -50,4 +50,3 @@ export type FsArchiveZipResult = {
50
50
  fileCount: number;
51
51
  totalSize: number;
52
52
  };
53
- //# sourceMappingURL=fs.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=fs.js.map
@@ -14,4 +14,3 @@ export * from './project.ts';
14
14
  export * from './room.ts';
15
15
  export * from './agent-capabilities.ts';
16
16
  export * from './agent-workspace.ts';
17
- //# sourceMappingURL=index.d.ts.map
@@ -14,4 +14,3 @@ export * from "./project.js";
14
14
  export * from "./room.js";
15
15
  export * from "./agent-capabilities.js";
16
16
  export * from "./agent-workspace.js";
17
- //# sourceMappingURL=index.js.map
@@ -100,4 +100,3 @@ export type MachineGrant = {
100
100
  createdAt: string;
101
101
  redeemed: boolean;
102
102
  };
103
- //# sourceMappingURL=machine.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=machine.js.map
@@ -57,4 +57,3 @@ export declare function isSystemControlPayload(payload: string): boolean;
57
57
  export declare function stripGitDirectiveArtifacts(text: string): string;
58
58
  export declare function extractPayloadText(payload: string): string;
59
59
  export {};
60
- //# sourceMappingURL=message-payload.d.ts.map
@@ -223,4 +223,3 @@ export function extractPayloadText(payload) {
223
223
  function stringOrUndefined(value) {
224
224
  return typeof value === 'string' && value.trim() ? value : undefined;
225
225
  }
226
- //# sourceMappingURL=message-payload.js.map
@@ -1,2 +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.refresh' | 'session.tool.detail' | 'session.title.set' | 'fs.ls' | 'fs.read' | 'fs.write' | 'fs.export.markdown-pdf' | 'fs.export.markdown-pdf.setup' | 'fs.archive.zip' | 'fs.transfer' | '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';
2
- //# sourceMappingURL=methods.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=methods.js.map
@@ -18,4 +18,3 @@ export type NativeSessionEventPayload = {
18
18
  export type NativeSessionImportBatch = {
19
19
  events: NativeSessionEventPayload[];
20
20
  };
21
- //# sourceMappingURL=native-session.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=native-session.js.map
@@ -12,4 +12,3 @@ export type NianProject = {
12
12
  createdAt: string;
13
13
  updatedAt: string;
14
14
  };
15
- //# sourceMappingURL=project.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=project.js.map
@@ -63,6 +63,7 @@ export type RoomMessageView = {
63
63
  roomId: string;
64
64
  sequence: RoomSequence;
65
65
  kind: RoomMessageKind;
66
+ source?: 'app' | 'cli' | 'managed_agent' | 'system';
66
67
  author: RoomAuthorSnapshot;
67
68
  mentions?: RoomMentionSnapshot[];
68
69
  text?: string | null;
@@ -95,6 +96,49 @@ export type RoomSyncParams = {
95
96
  afterSequence: RoomSequence;
96
97
  limit?: number;
97
98
  };
99
+ /** Public Skill + CLI read contract. It intentionally omits Room and membership IDs. */
100
+ export type RoomCliReadParams = {
101
+ before?: RoomSequence;
102
+ after?: RoomSequence;
103
+ limit?: number;
104
+ };
105
+ export type RoomCliAttachmentView = {
106
+ attachmentId: string;
107
+ mediaKind: RoomAttachmentKind;
108
+ name: string;
109
+ mimeType: string;
110
+ byteSize: RoomSequence;
111
+ sha256: string;
112
+ width?: number | null;
113
+ height?: number | null;
114
+ durationMs?: number | null;
115
+ status: RoomAttachmentStatus;
116
+ downloaded?: boolean;
117
+ localPath?: string | null;
118
+ };
119
+ export type RoomCliMessageView = {
120
+ sequence: RoomSequence;
121
+ kind: RoomMessageKind;
122
+ source: 'app' | 'cli' | 'managed_agent' | 'system';
123
+ author: {
124
+ nickname: string;
125
+ type: RoomPrincipalType;
126
+ ownerNickname?: string;
127
+ avatar?: Record<string, unknown> | null;
128
+ };
129
+ mentions: Array<{
130
+ nickname: string;
131
+ type: RoomPrincipalType;
132
+ }>;
133
+ text: string | null;
134
+ attachments: RoomCliAttachmentView[];
135
+ createdAt: string;
136
+ editedAt: string | null;
137
+ deletedAt: string | null;
138
+ };
139
+ export type RoomCliReadResult = {
140
+ messages: RoomCliMessageView[];
141
+ };
98
142
  export type RoomSendParams = {
99
143
  roomId: string;
100
144
  clientMessageId: string;
@@ -114,4 +158,3 @@ export type RoomBindParams = {
114
158
  export type RoomUnbindParams = {
115
159
  bindingId: string;
116
160
  };
117
- //# sourceMappingURL=room.d.ts.map
@@ -1,4 +1,3 @@
1
1
  // @arch docs/features/network-rooms/implementation-plan.md
2
2
  // @test src/__tests__/room.test.ts
3
3
  export {};
4
- //# sourceMappingURL=room.js.map
@@ -3,7 +3,7 @@ export type BuiltinAgentType = 'claude' | 'codex' | 'workbuddy' | 'gemini' | 'cu
3
3
  export type CustomAgentType = `custom:${string}`;
4
4
  export type AgentType = BuiltinAgentType | CustomAgentType;
5
5
  export declare const DISABLED_BUILTIN_AGENT_TYPES: readonly ["openclaw"];
6
- export declare const AVAILABLE_BUILTIN_AGENT_TYPES: readonly ["claude", "codex", "workbuddy", "gemini", "cursor", "opencode", "pi", "manager"];
6
+ export declare const AVAILABLE_BUILTIN_AGENT_TYPES: readonly ["claude", "codex", "workbuddy", "gemini", "cursor", "opencode", "pi"];
7
7
  export type ModelInfo = {
8
8
  id: string;
9
9
  name: string;
@@ -45,11 +45,18 @@ export type AgentRuntimeSummary = {
45
45
  export type AgentInfo = {
46
46
  type: AgentType;
47
47
  models: ModelInfo[];
48
+ /** True only after this real provider passed Manager-mode runtime validation. */
49
+ supportsManagerMode?: boolean;
48
50
  /** Per-machine Agent provider config summary (additive, non-secret). */
49
51
  config?: AgentConfigSummary;
50
52
  /** Non-secret runtime version and compatibility summary. */
51
53
  runtime?: AgentRuntimeSummary;
52
54
  };
55
+ export type SessionMode = 'standard' | 'manager';
56
+ export type ManagerConfig = {
57
+ defaultWorkerAgentType?: AgentType | null;
58
+ defaultWorkerModelId?: string | null;
59
+ };
53
60
  export declare function isAvailableBuiltinAgentType(value: string): value is BuiltinAgentType;
54
61
  export declare function isAvailableAgentType(value: string): value is AgentType;
55
62
  export declare function filterAvailableAgentTypes(values: readonly string[]): AgentType[];
@@ -152,6 +159,9 @@ export type NianSession = {
152
159
  machineId: string;
153
160
  userId: string;
154
161
  agentType: AgentType;
162
+ /** Missing on legacy records/clients and normalized to standard, except legacy agentType=manager. */
163
+ sessionMode?: SessionMode;
164
+ managerConfig?: ManagerConfig | null;
155
165
  agentSessionId: string | null;
156
166
  sourceMode?: NativeSessionSourceMode | null;
157
167
  modelId?: string | null;
@@ -181,11 +191,13 @@ export type NianSession = {
181
191
  activity?: SessionActivitySnapshot | null;
182
192
  externalChannel?: ExternalChannelSessionStatus | null;
183
193
  };
184
- export type SessionListProjection = Pick<NianSession, 'id' | 'machineId' | 'userId' | 'agentType' | 'agentSessionId' | 'modelId' | 'managerDefaultWorkerAgentType' | 'managerDefaultWorkerModelId' | 'title' | 'status' | 'workDir' | 'lastMessagePreview' | 'lastActivityAt' | 'createdAt' | 'updatedAt' | 'deletedAt' | 'machineName' | 'ownerName' | 'ownerPhone' | 'ownerEmail' | 'canManage' | 'sharedMachineSession' | 'activity' | 'externalChannel'>;
194
+ export type SessionListProjection = Pick<NianSession, 'id' | 'machineId' | 'userId' | 'agentType' | 'sessionMode' | 'managerConfig' | 'agentSessionId' | 'modelId' | 'managerDefaultWorkerAgentType' | 'managerDefaultWorkerModelId' | 'title' | 'status' | 'workDir' | 'lastMessagePreview' | 'lastActivityAt' | 'createdAt' | 'updatedAt' | 'deletedAt' | 'machineName' | 'ownerName' | 'ownerPhone' | 'ownerEmail' | 'canManage' | 'sharedMachineSession' | 'activity' | 'externalChannel'>;
185
195
  export type ChatSendParams = {
186
196
  sessionId: string;
187
197
  text: string;
188
198
  agentType: string;
199
+ sessionMode?: SessionMode;
200
+ managerConfig?: ManagerConfig | null;
189
201
  workDir: string;
190
202
  agentSessionId?: string | null;
191
203
  modelId?: string;
@@ -209,10 +221,14 @@ export type QueuedChatMessage = {
209
221
  sessionId: string;
210
222
  text: string;
211
223
  agentType: AgentType;
224
+ sessionMode?: SessionMode;
225
+ managerConfig?: ManagerConfig | null;
212
226
  workDir: string;
213
227
  agentSessionId?: string | null;
214
228
  modelId?: string | null;
215
229
  systemPrompt?: string | null;
230
+ managerDefaultWorkerAgentType?: AgentType | null;
231
+ managerDefaultWorkerModelId?: string | null;
216
232
  reasoningEffort?: string | null;
217
233
  clientMessageId?: string | null;
218
234
  attachments?: Array<{
@@ -270,4 +286,3 @@ export type FsReadParams = {
270
286
  path: string;
271
287
  rootPath?: string;
272
288
  };
273
- //# sourceMappingURL=session.d.ts.map
@@ -9,7 +9,6 @@ export const AVAILABLE_BUILTIN_AGENT_TYPES = [
9
9
  'cursor',
10
10
  'opencode',
11
11
  'pi',
12
- 'manager',
13
12
  ];
14
13
  const AVAILABLE_BUILTIN_AGENT_TYPE_SET = new Set(AVAILABLE_BUILTIN_AGENT_TYPES);
15
14
  export function isAvailableBuiltinAgentType(value) {
@@ -42,4 +41,3 @@ export function filterAvailableAgentInfos(agents) {
42
41
  }
43
42
  return filtered;
44
43
  }
45
- //# sourceMappingURL=session.js.map
@@ -28,4 +28,3 @@ export type SessionToolDetailResponse = {
28
28
  source: ToolDetailSource;
29
29
  reason?: string;
30
30
  };
31
- //# sourceMappingURL=tool-detail.d.ts.map
@@ -1,4 +1,3 @@
1
1
  // @arch docs/architecture/data-retention-and-sync-policy.md#tool-结果
2
2
  // @test src/__tests__/types.test.ts
3
3
  export {};
4
- //# sourceMappingURL=tool-detail.js.map
@@ -113,4 +113,3 @@ export type VoiceChiefServerFrame = {
113
113
  message: string;
114
114
  recoverable: boolean;
115
115
  };
116
- //# sourceMappingURL=voice-chief.d.ts.map
@@ -1,4 +1,3 @@
1
1
  // @arch docs/features/voice-shennian.md
2
2
  // @test packages/server/src/__tests__/voice-chief-realtime.test.ts
3
3
  export {};
4
- //# sourceMappingURL=voice-chief.js.map
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "scripts": {
20
20
  "build": "tsc",
21
+ "build:publish": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc --sourceMap false --declarationMap false",
21
22
  "dev": "tsc --watch",
22
23
  "prepublishOnly": "pnpm build"
23
24
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shennian",
3
- "version": "0.3.37",
3
+ "version": "0.3.39",
4
4
  "description": "Shennian — AI Agent Control Plane CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsc && node -e \"require('node:fs').chmodSync('dist/bin/shennian.js', 0o755)\"",
57
- "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",
57
+ "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",
58
58
  "dev": "tsc --watch"
59
59
  }
60
60
  }
@@ -1,47 +0,0 @@
1
- import type { ResolvedCommandSpec } from '../agents/command-spec.js';
2
- import { type ClaudeRoomPluginBundle, type RoomPluginMarketplaceBundle } from './room-plugin-bundles.js';
3
- import { type IntegrationCommandResult } from './room-plugin-lifecycle-common.js';
4
- type Bundle = RoomPluginMarketplaceBundle<ClaudeRoomPluginBundle>;
5
- type Action = 'install' | 'enable' | 'disable' | 'update' | 'uninstall';
6
- export type ClaudeRoomPluginStatus = {
7
- available: boolean;
8
- state: 'unavailable' | 'not_installed' | 'enabled' | 'disabled' | 'conflict';
9
- installedVersion: string | null;
10
- availableVersion: string | null;
11
- needsUpdate: boolean;
12
- consentRequired: boolean;
13
- restartRequired: boolean;
14
- errorCode?: string;
15
- };
16
- export declare class ClaudeRoomPluginLifecycle {
17
- private readonly receiptPath;
18
- private readonly configRoot;
19
- private readonly resolveCommand;
20
- private readonly ensureBundle;
21
- private readonly runCommand;
22
- constructor(options?: {
23
- receiptPath?: string;
24
- configRoot?: string;
25
- resolveCommand?: () => ResolvedCommandSpec | null;
26
- ensureBundle?: () => Bundle;
27
- runCommand?: (spec: ResolvedCommandSpec, args: string[]) => Promise<IntegrationCommandResult>;
28
- });
29
- status(options?: {
30
- bundle?: Bundle;
31
- restartRequired?: boolean;
32
- }): Promise<ClaudeRoomPluginStatus>;
33
- apply(action: Action): Promise<ClaudeRoomPluginStatus>;
34
- private install;
35
- private enable;
36
- private disable;
37
- private update;
38
- private uninstall;
39
- private ensureMarketplaceRegistered;
40
- private listMarketplaces;
41
- private listPlugins;
42
- private run;
43
- private readReceipt;
44
- private writeReceipt;
45
- private removeReceipt;
46
- }
47
- export {};
@@ -1 +0,0 @@
1
- import g from"node:os";import f from"node:path";import{resolveBuiltinCommand as R}from"../agents/command-spec.js";import{resolveShennianPath as b}from"../config/index.js";import{ensureClaudeRoomMarketplaceBundle as _}from"./room-plugin-bundles.js";import{ensurePrivateDirectory as v,writeJsonAtomic as y}from"./room-plugin-shared.js";import{hashDirectoryContent as m,hashPath as c,parseJson as w,readJsonFile as k,removePrivateFile as C,RoomPluginLifecycleError as n,runIntegrationCommand as V,sameRealPath as p}from"./room-plugin-lifecycle-common.js";const l="shennian",s=`shennian-room@${l}`;class j{receiptPath;configRoot;resolveCommand;ensureBundle;runCommand;constructor(a={}){this.receiptPath=a.receiptPath??b("integrations","claude-code","installation.json"),this.configRoot=a.configRoot??process.env.CLAUDE_CONFIG_DIR?.trim()??f.join(g.homedir(),".claude"),this.resolveCommand=a.resolveCommand??(()=>R("claude")),this.ensureBundle=a.ensureBundle??(()=>_()),this.runCommand=a.runCommand??((e,t)=>V(e,t))}async status(a={}){const e=this.resolveCommand();if(!e)return P();const t=a.bundle??this.ensureBundle(),i=this.readReceipt(t),r=(await this.listMarketplaces(e)).find(u=>u.name===l);if(r&&!p(r.path,t.marketplaceRoot))return A(t,"foreign_marketplace");const d=(await this.listPlugins(e)).find(u=>u.id===s);if(d){const u=d.version!==t.pluginVersion||i!=null&&(i.state==="installing"||i.bundleContentHash!==m(t.pluginRoot));return{available:!0,state:d.enabled?"enabled":"disabled",installedVersion:d.version,availableVersion:t.pluginVersion,needsUpdate:u,consentRequired:i==null,restartRequired:!!a.restartRequired}}return{available:!0,state:"not_installed",installedVersion:null,availableVersion:t.pluginVersion,needsUpdate:!1,consentRequired:i==null,restartRequired:!!a.restartRequired}}async apply(a){const e=this.resolveCommand();if(!e)throw new n("claude_unavailable");const t=this.ensureBundle(),i=await this.status({bundle:t});if(i.state==="conflict")throw new n(i.errorCode??"integration_conflict");if(a==="install")await this.install(e,t,i);else{if(!this.readReceipt(t))throw new n("user_consent_required");a==="enable"?await this.enable(e,t,i):a==="disable"?await this.disable(e,t,i):a==="update"?await this.update(e,t,i):await this.uninstall(e,t,i)}return this.status({bundle:t,restartRequired:!0})}async install(a,e,t){this.writeReceipt(e,"installing"),await this.ensureMarketplaceRegistered(a,e),t.state==="not_installed"?await this.run(a,["plugin","install",s,"--scope","user","--yes"]):t.needsUpdate&&await this.run(a,["plugin","update",s,"--scope","user","--yes"]),t.state==="disabled"&&await this.run(a,["plugin","enable",s,"--scope","user"]),this.writeReceipt(e,"installed")}async enable(a,e,t){if(t.state==="not_installed")throw new n("plugin_not_installed");t.state==="disabled"&&await this.run(a,["plugin","enable",s,"--scope","user"]),this.writeReceipt(e,"installed")}async disable(a,e,t){if(t.state==="not_installed")throw new n("plugin_not_installed");t.state==="enabled"&&await this.run(a,["plugin","disable",s,"--scope","user"]),this.writeReceipt(e,"disabled")}async update(a,e,t){if(t.state==="not_installed")throw new n("plugin_not_installed");await this.run(a,["plugin","marketplace","update",l]),t.installedVersion===t.availableVersion?(await this.run(a,["plugin","uninstall",s,"--scope","user","--yes"]),await this.run(a,["plugin","install",s,"--scope","user","--yes"]),t.state==="disabled"&&await this.run(a,["plugin","disable",s,"--scope","user"])):await this.run(a,["plugin","update",s,"--scope","user","--yes"]),this.writeReceipt(e,t.state==="disabled"?"disabled":"installed")}async uninstall(a,e,t){t.state!=="not_installed"&&await this.run(a,["plugin","uninstall",s,"--scope","user","--yes"]);const i=(await this.listMarketplaces(a)).find(r=>r.name===l);i&&p(i.path,e.marketplaceRoot)&&await this.run(a,["plugin","marketplace","remove",l,"--scope","user"]),this.removeReceipt()}async ensureMarketplaceRegistered(a,e){const t=(await this.listMarketplaces(a)).find(i=>i.name===l);if(!t){await this.run(a,["plugin","marketplace","add",e.marketplaceRoot,"--scope","user"]);return}if(!p(t.path,e.marketplaceRoot))throw new n("foreign_marketplace")}async listMarketplaces(a){const e=await this.run(a,["plugin","marketplace","list","--json"]),t=w(e.stdout,"invalid_marketplace_list");if(!Array.isArray(t))throw new n("invalid_marketplace_list");return t.map(i=>{if(!h(i)||typeof i.name!="string")throw new n("invalid_marketplace_list");const r=typeof i.path=="string"?i.path:typeof i.installLocation=="string"?i.installLocation:null;if(!r)throw new n("invalid_marketplace_list");return{name:i.name,path:r}})}async listPlugins(a){const e=await this.run(a,["plugin","list","--json"]),t=w(e.stdout,"invalid_plugin_list");if(!Array.isArray(t))throw new n("invalid_plugin_list");return t.map(i=>{if(!h(i)||typeof i.id!="string"||typeof i.version!="string"||typeof i.scope!="string"||typeof i.enabled!="boolean")throw new n("invalid_plugin_list");return{id:i.id,version:i.version,scope:i.scope,enabled:i.enabled}})}async run(a,e){const t=await this.runCommand(a,e);if(t.code!==0)throw new n("claude_command_failed");return t}readReceipt(a){const e=k(this.receiptPath);return e==null||!h(e)||e.schemaVersion!==1||e.runtime!=="claude_code"||e.pluginId!==s||e.marketplaceName!==l||e.consentVersion!==1||e.marketplaceRootHash!==c(a.marketplaceRoot)||e.claudeConfigHash!==c(this.configRoot)||typeof e.consentedAt!="string"||typeof e.lastActionAt!="string"||e.state!=="installing"&&e.state!=="installed"&&e.state!=="disabled"?null:e}writeReceipt(a,e){const t=this.readReceipt(a),i=new Date().toISOString();v(f.dirname(this.receiptPath)),y(this.receiptPath,{schemaVersion:1,runtime:"claude_code",pluginId:s,marketplaceName:l,marketplaceRootHash:c(a.marketplaceRoot),claudeConfigHash:c(this.configRoot),bundleContentHash:e==="installing"?t?.bundleContentHash:m(a.pluginRoot),consentVersion:1,state:e,consentedAt:t?.consentedAt??i,lastActionAt:i})}removeReceipt(){C(this.receiptPath)}}function h(o){return!!o&&typeof o=="object"&&!Array.isArray(o)}function P(){return{available:!1,state:"unavailable",installedVersion:null,availableVersion:null,needsUpdate:!1,consentRequired:!0,restartRequired:!1}}function A(o,a){return{available:!0,state:"conflict",installedVersion:null,availableVersion:o.pluginVersion,needsUpdate:!1,consentRequired:!0,restartRequired:!1,errorCode:a}}export{j as ClaudeRoomPluginLifecycle};
@@ -1,49 +0,0 @@
1
- import type { ResolvedCommandSpec } from '../agents/command-spec.js';
2
- import { type RoomPluginMarketplaceBundle, type CodexRoomPluginBundle } from './room-plugin-bundles.js';
3
- import { type IntegrationCommandResult } from './room-plugin-lifecycle-common.js';
4
- type Bundle = RoomPluginMarketplaceBundle<CodexRoomPluginBundle>;
5
- type Action = 'install' | 'enable' | 'disable' | 'update' | 'uninstall';
6
- export type CodexRoomPluginStatus = {
7
- available: boolean;
8
- state: 'unavailable' | 'not_installed' | 'enabled' | 'disabled' | 'conflict';
9
- installedVersion: string | null;
10
- availableVersion: string | null;
11
- needsUpdate: boolean;
12
- consentRequired: boolean;
13
- restartRequired: boolean;
14
- errorCode?: string;
15
- };
16
- export declare class CodexRoomPluginLifecycle {
17
- private readonly receiptPath;
18
- private readonly hooksFile;
19
- private readonly resolveCommand;
20
- private readonly ensureBundle;
21
- private readonly runCommand;
22
- constructor(options?: {
23
- receiptPath?: string;
24
- hooksFile?: string;
25
- resolveCommand?: () => ResolvedCommandSpec | null;
26
- ensureBundle?: () => Bundle;
27
- runCommand?: (spec: ResolvedCommandSpec, args: string[]) => Promise<IntegrationCommandResult>;
28
- });
29
- status(options?: {
30
- bundle?: Bundle;
31
- restartRequired?: boolean;
32
- }): Promise<CodexRoomPluginStatus>;
33
- apply(action: Action): Promise<CodexRoomPluginStatus>;
34
- private install;
35
- private enable;
36
- private disable;
37
- private update;
38
- private uninstall;
39
- private reinstallPlugin;
40
- private ensureMarketplaceRegistered;
41
- private removeHook;
42
- private listMarketplaces;
43
- private listPlugins;
44
- private run;
45
- private readReceipt;
46
- private writeReceipt;
47
- private removeReceipt;
48
- }
49
- export {};
@@ -1 +0,0 @@
1
- import b from"node:os";import m from"node:path";import{resolveBuiltinCommand as C}from"../agents/command-spec.js";import{resolveShennianPath as A}from"../config/index.js";import{ensureCodexRoomMarketplaceBundle as P}from"./room-plugin-bundles.js";import{ensurePrivateDirectory as j,writeJsonAtomic as g}from"./room-plugin-shared.js";import{hashDirectoryContent as w,hashPath as f,parseJson as v,readJsonFile as R,removePrivateFile as x,RoomPluginLifecycleError as a,runIntegrationCommand as H,sameRealPath as k}from"./room-plugin-lifecycle-common.js";const u="shennian",c=`shennian-room@${u}`;class L{receiptPath;hooksFile;resolveCommand;ensureBundle;runCommand;constructor(i={}){this.receiptPath=i.receiptPath??A("integrations","codex","installation.json");const e=process.env.CODEX_HOME?.trim()||m.join(b.homedir(),".codex");this.hooksFile=i.hooksFile??m.join(e,"hooks.json"),this.resolveCommand=i.resolveCommand??(()=>C("codex")),this.ensureBundle=i.ensureBundle??(()=>P()),this.runCommand=i.runCommand??((t,n)=>H(t,n))}async status(i={}){const e=this.resolveCommand();if(!e)return M();const t=i.bundle??this.ensureBundle(),n=this.readReceipt(t),r=(await this.listMarketplaces(e)).find(h=>h.name===u);if(r&&!k(r.root,t.marketplaceRoot))return _(t,"foreign_marketplace");const l=(await this.listPlugins(e)).find(h=>h.pluginId===c);if(l&&!k(l.sourcePath,t.pluginRoot))return _(t,"foreign_plugin_installation");if(l){const h=l.version!==t.pluginVersion||n!=null&&(n.state==="installing"||n.bundleContentHash!==w(t.pluginRoot));return{available:!0,state:l.enabled?"enabled":"disabled",installedVersion:l.version,availableVersion:t.pluginVersion,needsUpdate:h,consentRequired:n==null,restartRequired:!!i.restartRequired}}return{available:!0,state:n?.state==="disabled"?"disabled":"not_installed",installedVersion:null,availableVersion:t.pluginVersion,needsUpdate:!1,consentRequired:n==null,restartRequired:!!i.restartRequired}}async apply(i){const e=this.resolveCommand();if(!e)throw new a("codex_unavailable");const t=this.ensureBundle(),n=await this.status({bundle:t});if(n.state==="conflict")throw new a(n.errorCode??"integration_conflict");return i==="install"?await this.install(e,t,n):i==="enable"?await this.enable(e,t,n):i==="disable"?await this.disable(e,t,n):i==="update"?await this.update(e,t,n):await this.uninstall(e,t,n),i==="uninstall"?this.status({bundle:t,restartRequired:!0}):this.status({bundle:t,restartRequired:!0})}async install(i,e,t){const n=this.readReceipt(e)?.hookCommand;n&&this.removeHook(n),this.writeReceipt(e,"installing"),await this.ensureMarketplaceRegistered(i,e),t.state==="enabled"?t.needsUpdate&&await this.reinstallPlugin(i):await this.run(i,["plugin","add",c,"--json"]),this.writeReceipt(e,"installed")}async enable(i,e,t){if(!this.readReceipt(e))throw new a("user_consent_required");t.state!=="enabled"&&(await this.ensureMarketplaceRegistered(i,e),await this.run(i,["plugin","add",c,"--json"]),this.writeReceipt(e,"installed"))}async disable(i,e,t){const n=this.readReceipt(e);if(!n)throw new a("user_consent_required");t.state==="enabled"&&await this.run(i,["plugin","remove",c,"--json"]),this.removeHook(n.hookCommand),this.writeReceipt(e,"disabled")}async update(i,e,t){const n=this.readReceipt(e);if(!n)throw new a("user_consent_required");if(this.removeHook(n.hookCommand),t.state==="enabled"){await this.reinstallPlugin(i),this.writeReceipt(e,"installed");return}this.writeReceipt(e,"disabled")}async uninstall(i,e,t){const n=this.readReceipt(e);if(t.state==="enabled"&&await this.run(i,["plugin","remove",c,"--json"]),n){this.removeHook(n.hookCommand);const d=(await this.listMarketplaces(i)).find(r=>r.name===u);d&&k(d.root,e.marketplaceRoot)&&await this.run(i,["plugin","marketplace","remove",u,"--json"])}this.removeReceipt()}async reinstallPlugin(i){await this.run(i,["plugin","remove",c,"--json"]),await this.run(i,["plugin","add",c,"--json"])}async ensureMarketplaceRegistered(i,e){const t=(await this.listMarketplaces(i)).find(n=>n.name===u);if(!t){await this.run(i,["plugin","marketplace","add",e.marketplaceRoot,"--json"]);return}if(!k(t.root,e.marketplaceRoot))throw new a("foreign_marketplace")}removeHook(i){const e=y(this.hooksFile,!0);if(!e.exists)return;const t={};for(const[n,d]of Object.entries(e.hooks)){const r=d.flatMap(p=>q(p,i));r.length>0&&(t[n]=r)}g(this.hooksFile,{...e.root,hooks:t})}async listMarketplaces(i){const e=await this.run(i,["plugin","marketplace","list","--json"]),t=v(e.stdout,"invalid_marketplace_list");if(!s(t)||!Array.isArray(t.marketplaces))throw new a("invalid_marketplace_list");return t.marketplaces.map(n=>{if(!s(n)||typeof n.name!="string"||typeof n.root!="string")throw new a("invalid_marketplace_list");return{name:n.name,root:n.root}})}async listPlugins(i){const e=await this.run(i,["plugin","list","--json"]),t=v(e.stdout,"invalid_plugin_list");if(!s(t)||!Array.isArray(t.installed))throw new a("invalid_plugin_list");return t.installed.map(n=>{if(!s(n)||typeof n.pluginId!="string"||typeof n.version!="string"||typeof n.enabled!="boolean"||!s(n.source)||typeof n.source.path!="string")throw new a("invalid_plugin_list");return{pluginId:n.pluginId,version:n.version,enabled:n.enabled,sourcePath:n.source.path}})}async run(i,e){const t=await this.runCommand(i,e);if(t.code!==0)throw new a("codex_command_failed");return t}readReceipt(i){const e=R(this.receiptPath);return e==null||!s(e)||e.schemaVersion!==1||e.runtime!=="codex"||e.pluginId!==c||e.marketplaceName!==u||e.consentVersion!==1||e.marketplaceRootHash!==f(i.marketplaceRoot)||e.codexHomeHash!==f(m.dirname(this.hooksFile))||typeof e.hookCommand!="string"||typeof e.consentedAt!="string"||typeof e.lastActionAt!="string"||e.state!=="installing"&&e.state!=="installed"&&e.state!=="disabled"?null:e}writeReceipt(i,e){const t=this.readReceipt(i),n=new Date().toISOString();j(m.dirname(this.receiptPath)),g(this.receiptPath,{schemaVersion:1,runtime:"codex",pluginId:c,marketplaceName:u,marketplaceRootHash:f(i.marketplaceRoot),codexHomeHash:f(m.dirname(this.hooksFile)),hookCommand:V(i),bundleContentHash:e==="installing"?t?.bundleContentHash:w(i.pluginRoot),consentVersion:1,state:e,consentedAt:t?.consentedAt??n,lastActionAt:n})}removeReceipt(){x(this.receiptPath)}}function V(o){const i=y(o.hooksFile);for(const e of Object.values(i.hooks))for(const t of e)if(!(!s(t)||!Array.isArray(t.hooks))){for(const n of t.hooks)if(s(n)&&n.type==="command"&&typeof n.command=="string")return n.command}throw new a("invalid_generated_hook")}function y(o,i=!1){const e=R(o);if(e==null&&i)return{exists:!1,root:{},hooks:{}};if(!s(e))throw new a("invalid_hook_config");const t=e.hooks;if(t!=null&&!s(t))throw new a("invalid_hook_config");const n={};for(const[p,l]of Object.entries(t??{})){if(!Array.isArray(l))throw new a("invalid_hook_config");n[p]=l}const{hooks:d,...r}=e;return{exists:!0,root:r,hooks:n}}function q(o,i){if(!s(o)||!Array.isArray(o.hooks))return[o];const e=o.hooks.filter(t=>!s(t)||t.command!==i);return e.length>0?[{...o,hooks:e}]:[]}function s(o){return!!o&&typeof o=="object"&&!Array.isArray(o)}function M(){return{available:!1,state:"unavailable",installedVersion:null,availableVersion:null,needsUpdate:!1,consentRequired:!0,restartRequired:!1}}function _(o,i){return{available:!0,state:"conflict",installedVersion:null,availableVersion:o.pluginVersion,needsUpdate:!1,consentRequired:!0,restartRequired:!1,errorCode:i}}export{L as CodexRoomPluginLifecycle};
@@ -1,23 +0,0 @@
1
- import { type RoomPluginFileOptions, type RoomPluginFiles } from './room-plugin-shared.js';
2
- export type CodexRoomPluginBundle = RoomPluginFiles & {
3
- manifestFile: string;
4
- };
5
- export type ClaudeRoomPluginBundle = RoomPluginFiles & {
6
- manifestFile: string;
7
- };
8
- export type RoomPluginMarketplaceBundle<T extends RoomPluginFiles> = T & {
9
- marketplaceRoot: string;
10
- marketplaceManifest: string;
11
- };
12
- export declare function ensureCodexRoomPluginBundle(options?: RoomPluginFileOptions & {
13
- pluginRoot?: string;
14
- }): CodexRoomPluginBundle;
15
- export declare function ensureClaudeRoomPluginBundle(options?: RoomPluginFileOptions & {
16
- pluginRoot?: string;
17
- }): ClaudeRoomPluginBundle;
18
- export declare function ensureCodexRoomMarketplaceBundle(options?: RoomPluginFileOptions & {
19
- marketplaceRoot?: string;
20
- }): RoomPluginMarketplaceBundle<CodexRoomPluginBundle>;
21
- export declare function ensureClaudeRoomMarketplaceBundle(options?: RoomPluginFileOptions & {
22
- marketplaceRoot?: string;
23
- }): RoomPluginMarketplaceBundle<ClaudeRoomPluginBundle>;
@@ -1 +0,0 @@
1
- import e from"node:path";import{resolveShennianPath as l}from"../config/index.js";import{ensurePrivateDirectory as a,ensureSharedRoomPluginFiles as p,ROOM_PLUGIN_NAME as s,writeJsonAtomic as c}from"./room-plugin-shared.js";function u(o={}){const n=o.pluginRoot??l("integrations","codex","plugin"),t=p("codex",n,o),i=e.join(n,".codex-plugin"),r=e.join(i,"plugin.json");return a(i),c(r,{name:s,version:t.pluginVersion,description:"Connect Codex to Shennian collaboration spaces and stable private Agents.",author:{name:"Shennian"},homepage:"https://shennian.net",license:"MIT",keywords:["shennian","room","collaboration"],skills:"./skills/",mcpServers:"./.mcp.json",interface:{displayName:"Shennian Room",shortDescription:"Collaborate with people and Agents in a Shennian space.",longDescription:"Create or join a Shennian collaboration space and securely exchange messages from the current Codex conversation.",developerName:"Shennian",category:"Productivity",capabilities:["Interactive","Read","Write"],websiteURL:"https://shennian.net",defaultPrompt:["Create a collaboration space for this conversation.","Join this Shennian invitation link.","Create a private Shennian Agent for this project."]}}),{...t,manifestFile:r}}function g(o={}){const n=o.pluginRoot??l("integrations","claude-code","plugin"),t=p("claude_code",n,o),i=e.join(n,".claude-plugin"),r=e.join(i,"plugin.json");return a(i),c(r,{name:s,version:t.pluginVersion,description:"Connect the current Claude Code conversation to a Shennian collaboration space.",author:{name:"Shennian"},homepage:"https://shennian.net",license:"MIT"}),{...t,manifestFile:r}}function f(o={}){const n=o.marketplaceRoot??l("integrations","codex","marketplace");a(n),a(e.join(n,".agents")),a(e.join(n,".agents","plugins")),a(e.join(n,"plugins"));const t=u({...o,pluginRoot:e.join(n,"plugins",s)}),i=e.join(n,".agents","plugins","marketplace.json");return c(i,{name:"shennian",interface:{displayName:"Shennian"},plugins:[{name:s,source:{source:"local",path:`./plugins/${s}`},policy:{installation:"AVAILABLE",authentication:"ON_INSTALL"},category:"Productivity"}]}),{...t,marketplaceRoot:n,marketplaceManifest:i}}function R(o={}){const n=o.marketplaceRoot??l("integrations","claude-code","marketplace");a(n),a(e.join(n,".claude-plugin")),a(e.join(n,"plugins"));const t=g({...o,pluginRoot:e.join(n,"plugins",s)}),i=e.join(n,".claude-plugin","marketplace.json");return c(i,{name:"shennian",owner:{name:"Shennian"},plugins:[{name:s,source:`./plugins/${s}`,description:"Connect Claude Code to a Shennian collaboration space.",version:t.pluginVersion}]}),{...t,marketplaceRoot:n,marketplaceManifest:i}}export{R as ensureClaudeRoomMarketplaceBundle,g as ensureClaudeRoomPluginBundle,f as ensureCodexRoomMarketplaceBundle,u as ensureCodexRoomPluginBundle};
@@ -1,17 +0,0 @@
1
- import type { ResolvedCommandSpec } from '../agents/command-spec.js';
2
- export type IntegrationCommandResult = {
3
- code: number | null;
4
- stdout: string;
5
- stderr: string;
6
- };
7
- export declare function runIntegrationCommand(spec: ResolvedCommandSpec, args: string[], env?: NodeJS.ProcessEnv): Promise<IntegrationCommandResult>;
8
- export declare function parseJson(raw: string, code: string): unknown;
9
- export declare function hashPath(value: string): string;
10
- export declare function hashDirectoryContent(root: string): string;
11
- export declare function sameRealPath(first: string, second: string): boolean;
12
- export declare function readJsonFile(filePath: string, maxBytes?: number): unknown | null;
13
- export declare function removePrivateFile(filePath: string): void;
14
- export declare class RoomPluginLifecycleError extends Error {
15
- readonly code: string;
16
- constructor(code: string);
17
- }
@@ -1 +0,0 @@
1
- import h from"node:crypto";import a from"node:fs";import f from"node:path";import{spawnResolvedCommand as w}from"../agents/command-spec.js";const S=3e4,_=1024*1024;async function F(t,e,r=process.env){return await new Promise(l=>{const o=w(t,e,{env:r,cwd:process.cwd(),stdio:["ignore","pipe","pipe"]});let s="",n="",u=!1;const c=i=>{u||(u=!0,clearTimeout(m),l(i))},p=(i,y)=>`${i}${y.toString("utf8")}`.slice(-_);o.stdout?.on("data",i=>{s=p(s,i)}),o.stderr?.on("data",i=>{n=p(n,i)}),o.once("error",()=>c({code:null,stdout:s,stderr:""})),o.once("close",i=>c({code:i,stdout:s,stderr:n}));const m=setTimeout(()=>{o.kill("SIGTERM"),c({code:null,stdout:s,stderr:""})},S)})}function v(t,e){try{return JSON.parse(t)}catch{throw new d(e)}}function P(t){return h.createHash("sha256").update(f.resolve(t),"utf8").digest("hex")}function b(t){const e=h.createHash("sha256"),r=l=>{const o=a.readdirSync(l,{withFileTypes:!0}).sort((s,n)=>s.name.localeCompare(n.name));for(const s of o){const n=f.join(l,s.name),u=f.relative(t,n).split(f.sep).join("/"),c=a.lstatSync(n);if(c.isSymbolicLink())throw new d("unsafe_plugin_bundle");if(c.isDirectory()){e.update(`d:${u}\0`,"utf8"),r(n);continue}if(!c.isFile())throw new d("unsafe_plugin_bundle");e.update(`f:${u}:${c.size}\0`,"utf8"),e.update(a.readFileSync(n))}};return r(f.resolve(t)),e.digest("hex")}function C(t,e){try{const r=l=>{const o=a.realpathSync(l);return process.platform==="win32"?o.toLowerCase():o};return r(t)===r(e)}catch{return!1}}function L(t,e=1024*1024){try{const r=a.lstatSync(t);if(!r.isFile()||r.isSymbolicLink()||r.size>e)throw new d("unsafe_local_file");return v(a.readFileSync(t,"utf8"),"invalid_local_json")}catch(r){if(r.code==="ENOENT")return null;throw r}}function M(t){try{const e=a.lstatSync(t);if(!e.isFile()||e.isSymbolicLink())throw new d("unsafe_local_file");a.unlinkSync(t)}catch(e){if(e.code!=="ENOENT")throw e}}class d extends Error{code;constructor(e){super(`Room integration lifecycle failed (${e}).`),this.code=e,this.name="RoomPluginLifecycleError"}}export{d as RoomPluginLifecycleError,b as hashDirectoryContent,P as hashPath,v as parseJson,L as readJsonFile,M as removePrivateFile,F as runIntegrationCommand,C as sameRealPath};
@@ -1,24 +0,0 @@
1
- export declare const ROOM_PLUGIN_NAME = "shennian-room";
2
- export declare const ROOM_MCP_SERVER_NAME = "shennian_room";
3
- export declare function roomMcpHostToolName(runtime: RoomPluginRuntime): string;
4
- export type RoomPluginRuntime = 'codex' | 'claude_code' | 'workbuddy';
5
- export type RoomPluginFiles = {
6
- pluginRoot: string;
7
- pluginVersion: string;
8
- skillFile: string;
9
- mcpFile: string;
10
- hooksFile: string;
11
- hookLauncherFile: string | null;
12
- };
13
- export type RoomPluginFileOptions = {
14
- cliEntry?: string;
15
- nodePath?: string;
16
- version?: string;
17
- platform?: NodeJS.Platform;
18
- shennianHome?: string;
19
- };
20
- export declare function ensureSharedRoomPluginFiles(runtime: RoomPluginRuntime, pluginRoot: string, options?: RoomPluginFileOptions): RoomPluginFiles;
21
- export declare function ensurePrivateDirectory(directory: string): void;
22
- export declare function writeJsonAtomic(filePath: string, value: unknown): void;
23
- export declare function writeTextAtomic(filePath: string, value: string): void;
24
- export declare function normalizePluginVersion(value: string): string;