@crewx/sdk 0.8.0-rc.79 → 0.8.0-rc.82

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 (292) hide show
  1. package/dist/__tests__/adapter/context-builder.test.d.ts +1 -0
  2. package/dist/__tests__/adapter/plugin-helper.test.d.ts +1 -0
  3. package/dist/__tests__/adapter/registration-integration.test.d.ts +1 -0
  4. package/dist/__tests__/adapter/scoped-store.test.d.ts +1 -0
  5. package/dist/__tests__/plugins/conversation.test.d.ts +1 -0
  6. package/dist/__tests__/testing/createMockContext.test.d.ts +1 -0
  7. package/dist/adapter/context-builder.d.ts +0 -9
  8. package/dist/adapter/index.d.ts +0 -1
  9. package/dist/adapter/plugin-helper.d.ts +0 -7
  10. package/dist/adapter/scoped-store.d.ts +0 -10
  11. package/dist/adapter/types.d.ts +0 -7
  12. package/dist/agent/resolver.d.ts +0 -13
  13. package/dist/boxing/box-storage.interface.d.ts +0 -4
  14. package/dist/boxing/box.service.d.ts +0 -4
  15. package/dist/boxing/box.types.d.ts +0 -4
  16. package/dist/boxing/context-builder.d.ts +0 -4
  17. package/dist/client/CrewxClient.d.ts +0 -32
  18. package/dist/client/index.d.ts +0 -1
  19. package/dist/client/index.js +1 -6
  20. package/dist/config/loader.browser.d.ts +0 -8
  21. package/dist/config/loader.d.ts +0 -12
  22. package/dist/conversation/__tests__/sqlite-provider.test.d.ts +1 -0
  23. package/dist/conversation/__tests__/to-task-reader.test.d.ts +1 -0
  24. package/dist/conversation/index.d.ts +0 -1
  25. package/dist/conversation/sqlite-provider.d.ts +0 -9
  26. package/dist/conversation/to-task-reader.d.ts +0 -11
  27. package/dist/conversation/to-template-messages.d.ts +0 -13
  28. package/dist/conversation/types.d.ts +0 -58
  29. package/dist/esm/client/index.js +1 -2
  30. package/dist/esm/hooks/index.js +7 -6
  31. package/dist/esm/index.js +79 -60
  32. package/dist/esm/plugins/index.js +52 -0
  33. package/dist/esm/testing/index.js +1 -0
  34. package/dist/esm/tools/node/index.js +36 -54
  35. package/dist/events/TypedEventEmitter.d.ts +0 -24
  36. package/dist/events/types.d.ts +0 -43
  37. package/dist/facade/Crewx.browser.d.ts +0 -40
  38. package/dist/facade/Crewx.d.ts +0 -163
  39. package/dist/hooks/define.d.ts +0 -1
  40. package/dist/hooks/dispatch.d.ts +0 -12
  41. package/dist/hooks/index.d.ts +0 -1
  42. package/dist/hooks/index.js +7 -24
  43. package/dist/hooks/observer.d.ts +0 -1
  44. package/dist/hooks/plugin.d.ts +0 -1
  45. package/dist/hooks/tool-normalize.d.ts +0 -26
  46. package/dist/hooks/types.d.ts +0 -1
  47. package/dist/hooks/yaml-plugin.d.ts +0 -1
  48. package/dist/index.browser.d.ts +0 -7
  49. package/dist/index.browser.js +2 -25
  50. package/dist/index.d.ts +0 -4
  51. package/dist/index.js +79 -151
  52. package/dist/layout/loader.d.ts +0 -20
  53. package/dist/layout/props-validator.d.ts +0 -6
  54. package/dist/layout/renderer.d.ts +0 -24
  55. package/dist/layout/types.d.ts +0 -42
  56. package/dist/parallel/agent-runtime.d.ts +0 -11
  57. package/dist/parallel/helpers.d.ts +0 -1
  58. package/dist/parallel/index.d.ts +0 -1
  59. package/dist/parallel/parallel-runner.d.ts +0 -8
  60. package/dist/parallel/types.d.ts +0 -24
  61. package/dist/parsers/agent-call.util.d.ts +0 -3
  62. package/dist/parsers/claude.parser.d.ts +0 -8
  63. package/dist/parsers/codex.parser.d.ts +0 -8
  64. package/dist/parsers/copilot.parser.d.ts +0 -9
  65. package/dist/parsers/gemini.parser.d.ts +0 -10
  66. package/dist/parsers/opencode.parser.d.ts +0 -10
  67. package/dist/parsers/router.d.ts +0 -5
  68. package/dist/paths.d.ts +1 -0
  69. package/dist/platform/BrowserFsAdapter.d.ts +0 -20
  70. package/dist/platform/IFsAdapter.d.ts +0 -23
  71. package/dist/platform/NodeFsAdapter.d.ts +0 -8
  72. package/dist/plugin/plugin-provider.d.ts +0 -22
  73. package/dist/plugin/types.d.ts +0 -31
  74. package/dist/plugin.d.ts +0 -27
  75. package/dist/plugins/conversation.d.ts +0 -2
  76. package/dist/plugins/file-logger.d.ts +0 -13
  77. package/dist/plugins/index.d.ts +0 -10
  78. package/dist/plugins/index.js +52 -19
  79. package/dist/plugins/sqlite-tracing.d.ts +0 -13
  80. package/dist/plugins/sqlite-tracing.spec.d.ts +1 -0
  81. package/dist/provider/bridge.browser.d.ts +0 -20
  82. package/dist/provider/bridge.d.ts +0 -47
  83. package/dist/provider/parse-usage.d.ts +0 -14
  84. package/dist/provider/register-api.d.ts +0 -7
  85. package/dist/provider/vercel-runtime.d.ts +0 -29
  86. package/dist/remote/index.d.ts +0 -6
  87. package/dist/remote/remote-agent-manager.d.ts +0 -31
  88. package/dist/remote/remote-provider.d.ts +0 -15
  89. package/dist/remote/remote-transport.d.ts +0 -17
  90. package/dist/remote/types.d.ts +0 -59
  91. package/dist/server/auth.d.ts +0 -16
  92. package/dist/server/handler.d.ts +0 -17
  93. package/dist/server/index.d.ts +0 -4
  94. package/dist/server/tool-adapter.d.ts +0 -16
  95. package/dist/template/engine.d.ts +0 -19
  96. package/dist/template/helpers/exec.browser.d.ts +0 -7
  97. package/dist/template/helpers/exec.d.ts +0 -45
  98. package/dist/template/helpers/fenced_code.d.ts +0 -16
  99. package/dist/template/helpers/format-conversation.d.ts +0 -22
  100. package/dist/template/helpers/include.d.ts +0 -15
  101. package/dist/template/helpers/p1p2.d.ts +0 -32
  102. package/dist/template/loader/DocumentLoader.d.ts +0 -30
  103. package/dist/template/types.d.ts +0 -30
  104. package/dist/testing/index.d.ts +0 -1
  105. package/dist/testing/index.js +1 -16
  106. package/dist/testing/mock-audit.d.ts +0 -1
  107. package/dist/testing/mock-context.d.ts +0 -1
  108. package/dist/testing/mock-logger.d.ts +0 -1
  109. package/dist/testing/mock-router.d.ts +0 -1
  110. package/dist/testing/mock-storage.d.ts +0 -1
  111. package/dist/testing/mock-store.d.ts +0 -1
  112. package/dist/tools/delegate.d.ts +0 -7
  113. package/dist/tools/index.d.ts +0 -4
  114. package/dist/tools/node/builtin.d.ts +0 -16
  115. package/dist/tools/node/index.d.ts +0 -20
  116. package/dist/tools/node/index.js +36 -59
  117. package/dist/types/index.d.ts +0 -20
  118. package/dist/types/task-log.types.d.ts +0 -4
  119. package/dist/utils/env-defaults.d.ts +0 -16
  120. package/dist/utils/glob-match.d.ts +0 -16
  121. package/dist/utils/id.d.ts +0 -15
  122. package/dist/utils/timestamp.d.ts +0 -1
  123. package/dist/utils/workspace.d.ts +0 -4
  124. package/package.json +24 -25
  125. package/dist/adapter/context-builder.js +0 -87
  126. package/dist/adapter/index.js +0 -21
  127. package/dist/adapter/plugin-helper.js +0 -45
  128. package/dist/adapter/scoped-store.js +0 -43
  129. package/dist/adapter/types.js +0 -23
  130. package/dist/agent/resolver.js +0 -46
  131. package/dist/boxing/box-storage.interface.js +0 -6
  132. package/dist/boxing/box.service.js +0 -73
  133. package/dist/boxing/box.types.js +0 -6
  134. package/dist/boxing/context-builder.js +0 -79
  135. package/dist/client/CrewxClient.js +0 -86
  136. package/dist/config/loader.browser.js +0 -59
  137. package/dist/config/loader.js +0 -95
  138. package/dist/conversation/index.js +0 -25
  139. package/dist/conversation/sqlite-provider.js +0 -178
  140. package/dist/conversation/to-task-reader.js +0 -28
  141. package/dist/conversation/to-template-messages.js +0 -34
  142. package/dist/conversation/types.js +0 -10
  143. package/dist/esm/agent/resolver.js +0 -41
  144. package/dist/esm/boxing/box-storage.interface.js +0 -5
  145. package/dist/esm/boxing/box.service.js +0 -69
  146. package/dist/esm/boxing/box.types.js +0 -5
  147. package/dist/esm/boxing/context-builder.js +0 -76
  148. package/dist/esm/client/CrewxClient.js +0 -82
  149. package/dist/esm/config/loader.browser.js +0 -54
  150. package/dist/esm/config/loader.js +0 -77
  151. package/dist/esm/events/TypedEventEmitter.js +0 -61
  152. package/dist/esm/events/types.js +0 -8
  153. package/dist/esm/facade/Crewx.browser.js +0 -310
  154. package/dist/esm/facade/Crewx.js +0 -941
  155. package/dist/esm/hooks/define.js +0 -10
  156. package/dist/esm/hooks/dispatch.js +0 -76
  157. package/dist/esm/hooks/observer.js +0 -56
  158. package/dist/esm/hooks/plugin.js +0 -12
  159. package/dist/esm/hooks/types.js +0 -9
  160. package/dist/esm/index.browser.js +0 -15
  161. package/dist/esm/layout/loader.js +0 -268
  162. package/dist/esm/layout/props-validator.js +0 -297
  163. package/dist/esm/layout/renderer.js +0 -180
  164. package/dist/esm/layout/types.js +0 -31
  165. package/dist/esm/parallel/agent-runtime.js +0 -21
  166. package/dist/esm/parallel/helpers.js +0 -214
  167. package/dist/esm/parallel/index.js +0 -5
  168. package/dist/esm/parallel/parallel-runner.js +0 -221
  169. package/dist/esm/parallel/types.js +0 -5
  170. package/dist/esm/parsers/agent-call.util.js +0 -15
  171. package/dist/esm/parsers/claude.parser.js +0 -64
  172. package/dist/esm/parsers/codex.parser.js +0 -97
  173. package/dist/esm/parsers/copilot.parser.js +0 -63
  174. package/dist/esm/parsers/gemini.parser.js +0 -43
  175. package/dist/esm/parsers/opencode.parser.js +0 -73
  176. package/dist/esm/parsers/router.js +0 -53
  177. package/dist/esm/platform/BrowserFsAdapter.js +0 -80
  178. package/dist/esm/platform/IFsAdapter.js +0 -2
  179. package/dist/esm/platform/NodeFsAdapter.js +0 -34
  180. package/dist/esm/plugin/plugin-provider.js +0 -202
  181. package/dist/esm/plugin/types.js +0 -8
  182. package/dist/esm/plugin.js +0 -25
  183. package/dist/esm/provider/bridge.browser.js +0 -43
  184. package/dist/esm/provider/bridge.js +0 -373
  185. package/dist/esm/provider/parse-usage.js +0 -80
  186. package/dist/esm/provider/register-api.js +0 -21
  187. package/dist/esm/provider/vercel-runtime.js +0 -310
  188. package/dist/esm/remote/index.js +0 -10
  189. package/dist/esm/remote/remote-agent-manager.js +0 -194
  190. package/dist/esm/remote/remote-provider.js +0 -98
  191. package/dist/esm/remote/remote-transport.js +0 -79
  192. package/dist/esm/remote/types.js +0 -8
  193. package/dist/esm/server/auth.js +0 -31
  194. package/dist/esm/server/handler.js +0 -72
  195. package/dist/esm/server/index.js +0 -5
  196. package/dist/esm/server/tool-adapter.js +0 -92
  197. package/dist/esm/template/engine.js +0 -100
  198. package/dist/esm/template/helpers/exec.browser.js +0 -31
  199. package/dist/esm/template/helpers/exec.js +0 -220
  200. package/dist/esm/template/helpers/fenced_code.js +0 -17
  201. package/dist/esm/template/helpers/include.js +0 -20
  202. package/dist/esm/template/helpers/p1p2.js +0 -83
  203. package/dist/esm/template/loader/DocumentLoader.js +0 -124
  204. package/dist/esm/template/types.js +0 -5
  205. package/dist/esm/tools/delegate.js +0 -57
  206. package/dist/esm/tools/index.js +0 -5
  207. package/dist/esm/tools/node/builtin.js +0 -541
  208. package/dist/esm/types/index.js +0 -27
  209. package/dist/esm/types/task-log.types.js +0 -5
  210. package/dist/esm/utils/env-defaults.js +0 -23
  211. package/dist/esm/utils/glob-match.js +0 -38
  212. package/dist/esm/utils/id.js +0 -46
  213. package/dist/esm/utils/workspace.js +0 -21
  214. package/dist/events/TypedEventEmitter.js +0 -65
  215. package/dist/events/types.js +0 -9
  216. package/dist/facade/Crewx.browser.js +0 -314
  217. package/dist/facade/Crewx.js +0 -1299
  218. package/dist/hooks/define.js +0 -13
  219. package/dist/hooks/dispatch.js +0 -147
  220. package/dist/hooks/observer.js +0 -60
  221. package/dist/hooks/plugin.js +0 -17
  222. package/dist/hooks/tool-normalize.js +0 -110
  223. package/dist/hooks/types.js +0 -12
  224. package/dist/hooks/yaml-plugin.js +0 -356
  225. package/dist/layout/loader.js +0 -305
  226. package/dist/layout/props-validator.js +0 -301
  227. package/dist/layout/renderer.js +0 -193
  228. package/dist/layout/types.js +0 -36
  229. package/dist/parallel/agent-runtime.js +0 -25
  230. package/dist/parallel/helpers.js +0 -219
  231. package/dist/parallel/index.js +0 -13
  232. package/dist/parallel/parallel-runner.js +0 -226
  233. package/dist/parallel/types.js +0 -6
  234. package/dist/parsers/agent-call.util.js +0 -19
  235. package/dist/parsers/api.parser.d.ts +0 -10
  236. package/dist/parsers/api.parser.js +0 -26
  237. package/dist/parsers/claude.parser.js +0 -67
  238. package/dist/parsers/codex.parser.js +0 -100
  239. package/dist/parsers/copilot.parser.js +0 -66
  240. package/dist/parsers/gemini.parser.js +0 -46
  241. package/dist/parsers/opencode.parser.js +0 -76
  242. package/dist/parsers/router.js +0 -56
  243. package/dist/platform/BrowserFsAdapter.js +0 -84
  244. package/dist/platform/IFsAdapter.js +0 -3
  245. package/dist/platform/NodeFsAdapter.js +0 -38
  246. package/dist/plugin/plugin-provider.js +0 -207
  247. package/dist/plugin/types.js +0 -9
  248. package/dist/plugin.js +0 -29
  249. package/dist/plugins/conversation.js +0 -59
  250. package/dist/plugins/file-logger.js +0 -87
  251. package/dist/plugins/sqlite-tracing.js +0 -112
  252. package/dist/provider/bridge.browser.js +0 -49
  253. package/dist/provider/bridge.js +0 -381
  254. package/dist/provider/mastra-runtime.d.ts +0 -45
  255. package/dist/provider/mastra-runtime.js +0 -208
  256. package/dist/provider/parse-usage.js +0 -83
  257. package/dist/provider/register-api.js +0 -24
  258. package/dist/provider/vercel-runtime.js +0 -347
  259. package/dist/remote/index.js +0 -32
  260. package/dist/remote/remote-agent-manager.js +0 -198
  261. package/dist/remote/remote-provider.js +0 -141
  262. package/dist/remote/remote-transport.js +0 -83
  263. package/dist/remote/types.js +0 -9
  264. package/dist/server/auth.js +0 -35
  265. package/dist/server/handler.js +0 -75
  266. package/dist/server/index.js +0 -9
  267. package/dist/server/tool-adapter.js +0 -95
  268. package/dist/template/engine.js +0 -137
  269. package/dist/template/helpers/exec.browser.js +0 -41
  270. package/dist/template/helpers/exec.js +0 -230
  271. package/dist/template/helpers/fenced_code.js +0 -20
  272. package/dist/template/helpers/format-conversation.js +0 -53
  273. package/dist/template/helpers/include.js +0 -23
  274. package/dist/template/helpers/p1p2.js +0 -90
  275. package/dist/template/loader/DocumentLoader.js +0 -128
  276. package/dist/template/types.js +0 -6
  277. package/dist/testing/mock-audit.js +0 -13
  278. package/dist/testing/mock-context.js +0 -68
  279. package/dist/testing/mock-logger.js +0 -27
  280. package/dist/testing/mock-router.js +0 -67
  281. package/dist/testing/mock-storage.js +0 -21
  282. package/dist/testing/mock-store.js +0 -8
  283. package/dist/tools/delegate.js +0 -60
  284. package/dist/tools/index.js +0 -9
  285. package/dist/tools/node/builtin.js +0 -547
  286. package/dist/types/index.js +0 -32
  287. package/dist/types/task-log.types.js +0 -6
  288. package/dist/utils/env-defaults.js +0 -27
  289. package/dist/utils/glob-match.js +0 -42
  290. package/dist/utils/id.js +0 -50
  291. package/dist/utils/timestamp.js +0 -13
  292. package/dist/utils/workspace.js +0 -58
@@ -719,9 +719,7 @@ export type CrewxProjectConfig = z.infer<typeof CrewxProjectConfigSchema>;
719
719
  export interface CrewxOptions {
720
720
  workspaceRoot?: string;
721
721
  platform?: Platform;
722
- /** Exec policy for the template engine's {{exec}} helper. */
723
722
  execPolicy?: import('../template/types').ExecPolicy;
724
- /** API provider configuration (api/* namespace). */
725
723
  api?: {
726
724
  apiKeys?: Record<string, string>;
727
725
  defaults?: {
@@ -729,14 +727,6 @@ export interface CrewxOptions {
729
727
  temperature?: number;
730
728
  };
731
729
  };
732
- /**
733
- * Bootstrap factory for file:// remote agents. When the caller invokes an
734
- * agent whose provider is `remote/*` with `location: file://...`, the SDK
735
- * uses this factory to construct the target Crewx instance (so the target
736
- * inherits the same plugin/environment setup as the caller). Consumers pass
737
- * their own bootstrap wrapper (e.g. createCliCrewx, createServerCrewx).
738
- * If omitted, falls back to plain `Crewx.loadYaml(path)` without plugins.
739
- */
740
730
  remoteFactory?: (configPath: string) => Promise<import('../facade/Crewx').Crewx>;
741
731
  }
742
732
  export interface QueryOptions {
@@ -744,25 +734,19 @@ export interface QueryOptions {
744
734
  provider?: string;
745
735
  context?: string;
746
736
  metadata?: Record<string, unknown>;
747
- /** Conversation thread ID (passed through to task:start event) */
748
737
  threadId?: string;
749
- /** Platform origin. Propagated to task:start event. */
750
738
  platform?: Platform;
751
- /** Caller-provided conversation history (WI-CONV-002). Takes priority over auto-fetch. */
752
739
  messages?: import('../conversation/types').TemplateMessage[];
753
740
  }
754
741
  export interface QueryResult {
755
742
  ok: boolean;
756
743
  data: string;
757
- /** 'complete' when the agent finished, 'requires_action' when a client tool needs execution. */
758
744
  status?: 'complete' | 'requires_action';
759
- /** Pending client tool call — present when status is 'requires_action'. */
760
745
  toolCall?: {
761
746
  toolCallId: string;
762
747
  toolName: string;
763
748
  args: Record<string, unknown>;
764
749
  };
765
- /** Thread ID for continuing the conversation — present when status is 'requires_action'. */
766
750
  threadId?: string;
767
751
  error?: {
768
752
  code: string;
@@ -780,11 +764,8 @@ export interface ExecuteOptions {
780
764
  provider?: string;
781
765
  context?: string;
782
766
  metadata?: Record<string, unknown>;
783
- /** Conversation thread ID (passed through to task:start event) */
784
767
  threadId?: string;
785
- /** Platform origin. Propagated to task:start event. */
786
768
  platform?: Platform;
787
- /** Caller-provided conversation history (WI-CONV-002). Takes priority over auto-fetch. */
788
769
  messages?: import('../conversation/types').TemplateMessage[];
789
770
  }
790
771
  export interface ExecuteResult {
@@ -801,4 +782,3 @@ export interface ExecuteResult {
801
782
  durationMs: number;
802
783
  };
803
784
  }
804
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,3 @@
1
- /**
2
- * Task log types — shared types for task log entries across parsers and server code.
3
- */
4
1
  export type TaskLogEntryType = 'text' | 'tool_use' | 'tool_result' | 'error' | 'info' | 'agent_call';
5
2
  export interface TaskLogEntry {
6
3
  timestamp: string;
@@ -15,4 +12,3 @@ export interface TaskLogEntry {
15
12
  targetTaskId?: string;
16
13
  errorMessage?: string;
17
14
  }
18
- //# sourceMappingURL=task-log.types.d.ts.map
@@ -1,18 +1,2 @@
1
- /**
2
- * Centralized CREWX_* environment variable defaults.
3
- *
4
- * Priority: process.env value > hardcoded fallback.
5
- * No filesystem checks (cwd-dependent paths break in worktrees).
6
- * Browser-safe: guards process.env / process.cwd() access.
7
- */
8
- /**
9
- * Resolve CREWX_CLI path.
10
- * Returns process.env.CREWX_CLI if set, otherwise 'npx crewx'.
11
- */
12
1
  export declare function resolveCrewxCli(): string;
13
- /**
14
- * Resolve CREWX_WORKSPACE path.
15
- * Returns process.env.CREWX_WORKSPACE if set, otherwise current working directory.
16
- */
17
2
  export declare function resolveCrewxWorkspace(): string;
18
- //# sourceMappingURL=env-defaults.d.ts.map
@@ -1,18 +1,2 @@
1
- /**
2
- * Glob pattern matching utilities.
3
- * Shared by exec helper (security allow/deny) and agent ls filter.
4
- *
5
- * '*' — matches any characters within a single path segment (non-'/').
6
- * '**' — matches any characters including '/'.
7
- */
8
- /**
9
- * Converts a glob pattern to a RegExp.
10
- * Handles path-based matching (split by '/') consistent with minimatch behavior.
11
- */
12
1
  export declare function globToRegex(pattern: string): RegExp;
13
- /**
14
- * Checks if a value matches a glob pattern.
15
- * Returns false on any regex construction error.
16
- */
17
2
  export declare function matchesPattern(value: string, pattern: string): boolean;
18
- //# sourceMappingURL=glob-match.d.ts.map
@@ -1,19 +1,4 @@
1
- /**
2
- * ID generation utilities.
3
- * Backward-compatible with packages that import generateId from @crewx/sdk.
4
- */
5
- /**
6
- * Valid entity prefixes for generated IDs.
7
- */
8
1
  export type EntityPrefix = 'tsk' | 'thd' | 'msg' | 'box' | 'prj' | 'mem' | 'spn' | 'cron' | 'wbs' | 'job' | 'tcl' | 'req' | 'ws' | 'wfr';
9
2
  export type PrefixedId<P extends EntityPrefix> = `${P}_${string}`;
10
- /**
11
- * Generate a random prefixed ID.
12
- * @example generateId('tsk') // → "tsk_V1StGXR8"
13
- */
14
3
  export declare function generateId<P extends EntityPrefix>(prefix: P): PrefixedId<P>;
15
- /**
16
- * Generate a deterministic fingerprint ID from a string input.
17
- */
18
4
  export declare function generateFingerprint<P extends EntityPrefix>(prefix: P, input: string): PrefixedId<P>;
19
- //# sourceMappingURL=id.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function formatTimestamp(date: Date): string;
2
- //# sourceMappingURL=timestamp.d.ts.map
@@ -1,6 +1,2 @@
1
- /**
2
- * Workspace path normalization and hashing utilities.
3
- */
4
1
  export declare function normalizeWorkspacePath(workspacePath: string): string;
5
2
  export declare function hashWorkspaceId(workspacePath: string): string;
6
- //# sourceMappingURL=workspace.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/sdk",
3
- "version": "0.8.0-rc.79",
3
+ "version": "0.8.0-rc.82",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -12,39 +12,40 @@
12
12
  "types": "dist/index.d.ts",
13
13
  "exports": {
14
14
  ".": {
15
+ "types": "./dist/index.d.ts",
15
16
  "import": "./dist/index.js",
16
- "require": "./dist/index.js",
17
- "types": "./dist/index.d.ts"
17
+ "require": "./dist/index.js"
18
18
  },
19
19
  "./browser": {
20
- "import": "./dist/index.browser.js",
21
- "types": "./dist/index.browser.d.ts"
20
+ "types": "./dist/index.browser.d.ts",
21
+ "import": "./dist/index.browser.js"
22
22
  },
23
23
  "./client": {
24
+ "types": "./dist/client/index.d.ts",
24
25
  "import": "./dist/client/index.js",
25
- "require": "./dist/client/index.js",
26
- "types": "./dist/client/index.d.ts"
26
+ "require": "./dist/client/index.js"
27
27
  },
28
28
  "./tools/node": {
29
+ "types": "./dist/tools/node/index.d.ts",
29
30
  "import": "./dist/tools/node/index.js",
30
- "require": "./dist/tools/node/index.js",
31
- "types": "./dist/tools/node/index.d.ts"
31
+ "require": "./dist/tools/node/index.js"
32
32
  },
33
33
  "./hooks": {
34
+ "types": "./dist/hooks/index.d.ts",
34
35
  "import": "./dist/hooks/index.js",
35
- "require": "./dist/hooks/index.js",
36
- "types": "./dist/hooks/index.d.ts"
36
+ "require": "./dist/hooks/index.js"
37
37
  },
38
38
  "./testing": {
39
+ "types": "./dist/testing/index.d.ts",
39
40
  "import": "./dist/testing/index.js",
40
- "require": "./dist/testing/index.js",
41
- "types": "./dist/testing/index.d.ts"
41
+ "require": "./dist/testing/index.js"
42
42
  },
43
43
  "./plugins": {
44
+ "types": "./dist/plugins/index.d.ts",
44
45
  "import": "./dist/plugins/index.js",
45
- "require": "./dist/plugins/index.js",
46
- "types": "./dist/plugins/index.d.ts"
47
- }
46
+ "require": "./dist/plugins/index.js"
47
+ },
48
+ "./package.json": "./package.json"
48
49
  },
49
50
  "browser": {
50
51
  "./dist/template/helpers/exec.js": "./dist/template/helpers/exec.browser.js",
@@ -58,12 +59,7 @@
58
59
  "dist",
59
60
  "templates",
60
61
  "src/schemas/**/*.json",
61
- "README.md",
62
- "!**/__tests__",
63
- "!**/*.test.*",
64
- "!**/*.spec.*",
65
- "!**/*.js.map",
66
- "!**/*.d.ts.map"
62
+ "README.md"
67
63
  ],
68
64
  "dependencies": {
69
65
  "@modelcontextprotocol/sdk": "^1.27.0",
@@ -86,13 +82,16 @@
86
82
  "@types/js-yaml": "^4.0.9",
87
83
  "@types/node": "^22.0.0",
88
84
  "better-sqlite3": "^12.8.0",
85
+ "tsup": "^8.5.1",
89
86
  "typescript": "^5.4.0",
90
87
  "vitest": "^3.1.1"
91
88
  },
92
89
  "scripts": {
93
- "build": "tsc -p tsconfig.json",
94
- "build:esm": "tsc -p tsconfig.esm.json",
95
- "build:all": "npm run build && npm run build:esm",
90
+ "build:cjs": "npx tsup --config tsup.cjs.js",
91
+ "build:esm": "npx tsup --config tsup.esm.js",
92
+ "build:browser": "npx tsup --config tsup.browser.js",
93
+ "build:dts": "tsc -p tsconfig.dts.json",
94
+ "build": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:browser && pnpm run build:dts",
96
95
  "test": "vitest run --config ./vitest.config.ts",
97
96
  "test:watch": "vitest --config ./vitest.config.ts",
98
97
  "lint": "echo 'SDK lint pending' && exit 0"
@@ -1,87 +0,0 @@
1
- "use strict";
2
- /**
3
- * createAdapterContext — builds an AdapterContext for an adapter instance.
4
- *
5
- * M1: respondSync uses AsyncLocalStorage to bind the current HTTP response.
6
- * When called inside a registerRoute handler (sync window), respondSync writes
7
- * to the HTTP res. When called outside the sync window, it performs graceful
8
- * degradation: logs a warning instead of throwing (PoC correction #3).
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.getSyncWindowStore = getSyncWindowStore;
12
- exports.runInSyncWindow = runInSyncWindow;
13
- exports.createAdapterContext = createAdapterContext;
14
- const async_hooks_1 = require("async_hooks");
15
- const syncWindowStore = new async_hooks_1.AsyncLocalStorage();
16
- function getSyncWindowStore() {
17
- return syncWindowStore;
18
- }
19
- function runInSyncWindow(window, fn) {
20
- return syncWindowStore.run(window, fn);
21
- }
22
- function createAdapterContext(opts) {
23
- const log = opts.log ?? opts.logger ?? {
24
- debug: () => { },
25
- info: () => { },
26
- warn: () => { },
27
- error: () => { },
28
- };
29
- const agentRunner = opts.agentRunner ?? {
30
- run: async () => ({ output: '' }),
31
- };
32
- const db = opts.db ?? {
33
- get: async () => undefined,
34
- set: async () => { },
35
- delete: async () => false,
36
- list: async () => [],
37
- };
38
- const storage = opts.storage ?? {
39
- put: async () => '',
40
- get: async () => undefined,
41
- delete: async () => false,
42
- };
43
- const audit = opts.audit ?? {
44
- log: async () => { },
45
- };
46
- const inbound = opts.onInbound ?? (async () => ({ accepted: true }));
47
- const emitEventFn = opts.onEmitEvent ?? (async () => ({ accepted: true }));
48
- const updateMessage = opts.onUpdateMessage ?? (async () => { });
49
- const resolveUser = opts.onResolveUser ?? (async (userId) => ({
50
- userId,
51
- displayName: userId,
52
- }));
53
- const respondSync = async (payload) => {
54
- const window = syncWindowStore.getStore();
55
- if (!window) {
56
- log.warn('respondSync called outside sync window — graceful degradation (no-op)', {
57
- textPreview: typeof payload === 'object' && 'text' in payload ? payload.text.slice(0, 80) : undefined,
58
- });
59
- return;
60
- }
61
- const text = 'text' in payload ? payload.text : '';
62
- window.res.status(200).json({ text });
63
- };
64
- const httpRouter = opts.httpRouter ?? {
65
- registerRoute: () => {
66
- log.warn('httpRouter not configured — registerRoute is a no-op');
67
- },
68
- };
69
- return {
70
- instanceId: opts.instanceId,
71
- config: opts.config,
72
- capabilities: opts.capabilities,
73
- log,
74
- agentRunner,
75
- db,
76
- storage,
77
- audit,
78
- abortSignal: opts.abortSignal ?? new AbortController().signal,
79
- httpRouter,
80
- inbound,
81
- emitEvent: emitEventFn,
82
- updateMessage,
83
- resolveUser,
84
- respondSync,
85
- };
86
- }
87
- //# sourceMappingURL=context-builder.js.map
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./plugin-helper"), exports);
19
- __exportStar(require("./scoped-store"), exports);
20
- __exportStar(require("./context-builder"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1,45 +0,0 @@
1
- "use strict";
2
- /**
3
- * Plugin helpers for defining channel adapters.
4
- *
5
- * defineChannelAdapter — type-safe identity function for IChannelAdapter.
6
- * defineChannelAdapterPlugin — wraps an adapter as a CrewxPlugin (§3.3).
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.defineChannelAdapter = defineChannelAdapter;
10
- exports.defineChannelAdapterPlugin = defineChannelAdapterPlugin;
11
- function defineChannelAdapter(spec) {
12
- return spec;
13
- }
14
- function defineChannelAdapterPlugin(spec) {
15
- return {
16
- name: spec.name,
17
- async attach(crewx) {
18
- const config = await spec.configFactory(crewx);
19
- const anyCrewx = crewx;
20
- const registerFn = anyCrewx['registerChannelAdapter'];
21
- const instanceId = spec.instanceId ?? spec.name;
22
- if (registerFn) {
23
- await registerFn({
24
- adapter: spec.adapter,
25
- instanceId,
26
- config,
27
- });
28
- }
29
- if (spec.onAttach) {
30
- await spec.onAttach(crewx);
31
- }
32
- },
33
- async detach(crewx) {
34
- const anyCrewx = crewx;
35
- const unregisterFn = anyCrewx['unregisterChannelAdapter'];
36
- if (unregisterFn) {
37
- await unregisterFn(spec.instanceId ?? spec.name);
38
- }
39
- if (spec.onDetach) {
40
- await spec.onDetach(crewx);
41
- }
42
- },
43
- };
44
- }
45
- //# sourceMappingURL=plugin-helper.js.map
@@ -1,43 +0,0 @@
1
- "use strict";
2
- /**
3
- * ScopedAdapterStore — adapter key-value store with mandatory instanceId prefix.
4
- *
5
- * Security: Uses Map closure pattern (RT-1 defense).
6
- * The internal Map is captured in a function closure — no public or private
7
- * property on the returned AdapterStore object holds the raw Map reference.
8
- * Reflect / Object.getPrototypeOf / (ctx.db as any)['_rawStore'] all fail
9
- * because the Map only exists in the createScopedAdapterStore function scope.
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createScopedAdapterStore = createScopedAdapterStore;
13
- function createScopedAdapterStore(instanceId) {
14
- const store = new Map();
15
- const prefixKey = (key) => {
16
- if (key.startsWith(`${instanceId}::`))
17
- return key;
18
- return `${instanceId}::${key}`;
19
- };
20
- return {
21
- async get(key) {
22
- const entry = store.get(prefixKey(key));
23
- return entry ? entry.value : undefined;
24
- },
25
- async set(key, value) {
26
- store.set(prefixKey(key), { value });
27
- },
28
- async delete(key) {
29
- return store.delete(prefixKey(key));
30
- },
31
- async list(prefix) {
32
- const fullPrefix = prefix ? prefixKey(prefix) : `${instanceId}::`;
33
- const keys = [];
34
- for (const k of store.keys()) {
35
- if (k.startsWith(fullPrefix)) {
36
- keys.push(k.slice(instanceId.length + 2));
37
- }
38
- }
39
- return keys;
40
- },
41
- };
42
- }
43
- //# sourceMappingURL=scoped-store.js.map
@@ -1,23 +0,0 @@
1
- "use strict";
2
- /**
3
- * Adapter Platform v0.4 — core types.
4
- * PoC corrections applied:
5
- * 1. AdapterError: class only (interface removed)
6
- * 2. kind: added 'config' for configuration errors
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.AdapterError = void 0;
10
- class AdapterError extends Error {
11
- code;
12
- kind;
13
- retryAfterMs;
14
- constructor(code, kind, retryAfterMs) {
15
- super(`AdapterError: ${code}`);
16
- this.name = 'AdapterError';
17
- this.code = code;
18
- this.kind = kind;
19
- this.retryAfterMs = retryAfterMs;
20
- }
21
- }
22
- exports.AdapterError = AdapterError;
23
- //# sourceMappingURL=types.js.map
@@ -1,46 +0,0 @@
1
- "use strict";
2
- /**
3
- * Agent resolver: looks up an agent from a list by ref.
4
- * Supports both bare id ('claude') and @mention format ('@claude').
5
- * Falls back to built-in provider shorthands (claude, gemini, copilot, codex).
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AgentNotFoundError = void 0;
9
- exports.resolveAgent = resolveAgent;
10
- class AgentNotFoundError extends Error {
11
- constructor(agentRef, availableIds) {
12
- const available = availableIds.length > 0
13
- ? ` Available: ${availableIds.join(', ')}`
14
- : '';
15
- super(`Agent not found: "${agentRef}".${available}`);
16
- this.name = 'AgentNotFoundError';
17
- }
18
- }
19
- exports.AgentNotFoundError = AgentNotFoundError;
20
- /** Built-in provider shorthands that can be used without a crewx.yaml entry. */
21
- const BUILTIN_PROVIDERS = {
22
- claude: { id: 'claude', provider: 'cli/claude' },
23
- gemini: { id: 'gemini', provider: 'cli/gemini' },
24
- copilot: { id: 'copilot', provider: 'cli/copilot' },
25
- codex: { id: 'codex', provider: 'cli/codex' },
26
- };
27
- /**
28
- * Resolve an agent by reference.
29
- * @param agentRef - Agent reference: '@claude', 'claude', '@my_agent', etc.
30
- * @param agents - List of available agent configs.
31
- * @returns The matching AgentConfig.
32
- * @throws AgentNotFoundError when no match is found.
33
- */
34
- function resolveAgent(agentRef, agents) {
35
- const agentId = agentRef.startsWith('@') ? agentRef.slice(1) : agentRef;
36
- // 1. Look in YAML-defined agents first
37
- const agent = agents.find(a => a.id === agentId);
38
- if (agent)
39
- return agent;
40
- // 2. Fall back to built-in provider shorthands
41
- const builtin = BUILTIN_PROVIDERS[agentId];
42
- if (builtin)
43
- return builtin;
44
- throw new AgentNotFoundError(agentRef, agents.map(a => a.id));
45
- }
46
- //# sourceMappingURL=resolver.js.map
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /**
3
- * Box storage interfaces — used by SdkBoxService and buildContext.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- //# sourceMappingURL=box-storage.interface.js.map
@@ -1,73 +0,0 @@
1
- "use strict";
2
- /**
3
- * SdkBoxService — manages box creation, retrieval, and listing.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SdkBoxService = void 0;
7
- const id_1 = require("../utils/id");
8
- const ID_PATTERN = /^[a-zA-Z0-9._-]+$/;
9
- class SdkBoxService {
10
- storage;
11
- constructor(storage) {
12
- this.storage = storage;
13
- }
14
- listBoxes(threadId) {
15
- this.validateId(threadId);
16
- const rows = this.storage.listBoxes(threadId);
17
- const boxes = rows.map((row) => this.toBoxResponse(row));
18
- return { boxes, total: boxes.length };
19
- }
20
- getBox(threadId, boxId) {
21
- this.validateId(threadId);
22
- this.validateId(boxId);
23
- const row = this.storage.findBox(threadId, boxId);
24
- if (!row)
25
- return null;
26
- return this.toBoxResponse(row);
27
- }
28
- createBox(threadId, params) {
29
- this.validateId(threadId);
30
- const id = this.generateBoxId();
31
- const createdAt = new Date().toISOString();
32
- const row = this.storage.insertBox(threadId, {
33
- id,
34
- seq: params.seq,
35
- firstTaskId: params.firstTaskId,
36
- midTaskId: params.midTaskId,
37
- lastTaskId: params.lastTaskId,
38
- taskCount: params.taskCount,
39
- summary: params.summary ?? null,
40
- sourceTokens: params.sourceTokens,
41
- summaryTokens: params.summaryTokens ?? null,
42
- createdAt,
43
- });
44
- return this.toBoxResponse(row);
45
- }
46
- toBoxResponse(row) {
47
- return {
48
- id: row.id,
49
- threadId: row.thread_id,
50
- seq: row.seq,
51
- firstTaskId: row.first_task_id,
52
- lastTaskId: row.last_task_id,
53
- taskCount: row.task_count,
54
- sourceTokens: row.source_tokens,
55
- summaryTokens: row.summary_tokens,
56
- summary: row.summary,
57
- previewFirst: this.storage.getTaskPreview(row.first_task_id, 200),
58
- previewMid: this.storage.getTaskPreview(row.mid_task_id, 200),
59
- previewLast: this.storage.getTaskPreview(row.last_task_id, 200),
60
- createdAt: row.created_at,
61
- };
62
- }
63
- validateId(id) {
64
- if (!ID_PATTERN.test(id)) {
65
- throw new Error(`Invalid ID format: ${id}`);
66
- }
67
- }
68
- generateBoxId() {
69
- return (0, id_1.generateId)('box');
70
- }
71
- }
72
- exports.SdkBoxService = SdkBoxService;
73
- //# sourceMappingURL=box.service.js.map
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /**
3
- * Boxing domain types — Box/Thread/Context types for SDK boxing module.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- //# sourceMappingURL=box.types.js.map