@crewx/cli 0.9.0-rc.18 → 0.9.0-rc.180

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 (80) hide show
  1. package/dist/bootstrap/codex-writable-roots.d.ts +20 -1
  2. package/dist/bootstrap/codex-writable-roots.js +1 -88
  3. package/dist/bootstrap/crewx-cli.js +1 -63
  4. package/dist/bootstrap/rate-limit-snapshot.d.ts +15 -0
  5. package/dist/bootstrap/rate-limit-snapshot.js +1 -0
  6. package/dist/builtin.d.ts +1 -1
  7. package/dist/builtin.js +5 -127
  8. package/dist/commands/agent.d.ts +1 -0
  9. package/dist/commands/agent.js +3 -246
  10. package/dist/commands/ai-account.d.ts +4 -0
  11. package/dist/commands/ai-account.js +27 -0
  12. package/dist/commands/cal.d.ts +15 -0
  13. package/dist/commands/cal.js +2 -0
  14. package/dist/commands/command-help.d.ts +26 -0
  15. package/dist/commands/command-help.js +52 -0
  16. package/dist/commands/db.d.ts +3 -0
  17. package/dist/commands/db.js +59 -125
  18. package/dist/commands/detached.d.ts +102 -0
  19. package/dist/commands/detached.js +15 -0
  20. package/dist/commands/doctor.d.ts +77 -0
  21. package/dist/commands/doctor.js +4 -196
  22. package/dist/commands/emit-trailer.d.ts +25 -0
  23. package/dist/commands/emit-trailer.js +2 -0
  24. package/dist/commands/execute.d.ts +8 -4
  25. package/dist/commands/execute.js +15 -146
  26. package/dist/commands/hook/command-marker.d.ts +2 -0
  27. package/dist/commands/hook/command-marker.js +1 -0
  28. package/dist/commands/hook/install.d.ts +0 -1
  29. package/dist/commands/hook/install.js +8 -175
  30. package/dist/commands/hook/paths.js +1 -94
  31. package/dist/commands/hook/status.js +1 -86
  32. package/dist/commands/hook/uninstall.js +1 -71
  33. package/dist/commands/hook-dispatch.js +2 -180
  34. package/dist/commands/init.d.ts +34 -0
  35. package/dist/commands/init.js +38 -371
  36. package/dist/commands/kill.d.ts +2 -8
  37. package/dist/commands/kill.js +1 -52
  38. package/dist/commands/log.js +3 -95
  39. package/dist/commands/parse-agent-message.js +1 -52
  40. package/dist/commands/parse-common-flags.d.ts +5 -1
  41. package/dist/commands/parse-common-flags.js +3 -181
  42. package/dist/commands/ps.d.ts +2 -2
  43. package/dist/commands/ps.js +2 -107
  44. package/dist/commands/publish.d.ts +1 -0
  45. package/dist/commands/publish.js +27 -0
  46. package/dist/commands/query.d.ts +7 -2
  47. package/dist/commands/query.js +16 -146
  48. package/dist/commands/registry.js +1 -31
  49. package/dist/commands/resolve-prompt.js +3 -54
  50. package/dist/commands/resolve-recipient.d.ts +14 -0
  51. package/dist/commands/resolve-recipient.js +3 -0
  52. package/dist/commands/restart.d.ts +3 -1
  53. package/dist/commands/restart.js +18 -162
  54. package/dist/commands/result.d.ts +8 -3
  55. package/dist/commands/result.js +1 -70
  56. package/dist/commands/shortcut.d.ts +1 -0
  57. package/dist/commands/shortcut.js +18 -0
  58. package/dist/commands/slack.js +16 -559
  59. package/dist/commands/stop.d.ts +8 -0
  60. package/dist/commands/stop.js +8 -0
  61. package/dist/commands/write-output.js +1 -24
  62. package/dist/index.d.ts +1 -1
  63. package/dist/index.js +1 -5
  64. package/dist/logging.d.ts +1 -1
  65. package/dist/logging.js +10 -86
  66. package/dist/main.d.ts +3 -2
  67. package/dist/main.js +49 -253
  68. package/dist/register-builtin-tools.js +1 -9
  69. package/dist/slack/file-download.js +1 -134
  70. package/dist/slack/markdown.js +1 -33
  71. package/dist/utils/env-defaults.d.ts +2 -5
  72. package/dist/utils/env-defaults.js +1 -10
  73. package/dist/utils/inherited-trace.d.ts +24 -0
  74. package/dist/utils/inherited-trace.js +1 -25
  75. package/dist/utils/product-package-root.d.ts +6 -0
  76. package/dist/utils/product-package-root.js +1 -0
  77. package/dist/utils/sdk-compat.d.ts +24 -0
  78. package/dist/utils/sdk-compat.js +1 -0
  79. package/dist/utils/version.js +1 -28
  80. package/package.json +16 -12
@@ -1,5 +1,2 @@
1
- /**
2
- * CREWX_* environment variable defaults for CLI bootstrap.
3
- * Re-exported from @crewx/sdk for convenience.
4
- */
5
- export { resolveCrewxCli, resolveCrewxWorkspace } from '@crewx/sdk';
1
+ export declare function resolveCrewxCli(): string;
2
+ export declare function resolveCrewxWorkspace(): string;
@@ -1,10 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveCrewxWorkspace = exports.resolveCrewxCli = void 0;
4
- /**
5
- * CREWX_* environment variable defaults for CLI bootstrap.
6
- * Re-exported from @crewx/sdk for convenience.
7
- */
8
- var sdk_1 = require("@crewx/sdk");
9
- Object.defineProperty(exports, "resolveCrewxCli", { enumerable: true, get: function () { return sdk_1.resolveCrewxCli; } });
10
- Object.defineProperty(exports, "resolveCrewxWorkspace", { enumerable: true, get: function () { return sdk_1.resolveCrewxWorkspace; } });
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.resolveCrewxCli=r;exports.resolveCrewxWorkspace=o;const e=require("./sdk-compat");function r(){return e.sdkCompat.resolveCrewxCli()}function o(){return e.sdkCompat.resolveCrewxWorkspace()}
@@ -1,4 +1,19 @@
1
1
  import type { TraceContext } from '@crewx/sdk';
2
+ export interface InheritedRunnerIdentity {
3
+ assignedTaskId?: string;
4
+ detachedRunner: boolean;
5
+ }
6
+ /**
7
+ * Consume the runner-only identity exactly once.
8
+ *
9
+ * These variables are a one-hop capability, not trace context. Keeping the
10
+ * values in this module lets the current CLI process use them while deleting
11
+ * them from process.env prevents later child processes from inheriting the
12
+ * receipt runner identity.
13
+ */
14
+ export declare function consumeInheritedRunnerIdentity(): InheritedRunnerIdentity;
15
+ /** Test-only reset for the module-level one-shot cache. */
16
+ export declare function resetInheritedRunnerIdentityForTests(): void;
2
17
  /**
3
18
  * Read cross-process trace context from inherited environment variables.
4
19
  *
@@ -10,3 +25,12 @@ import type { TraceContext } from '@crewx/sdk';
10
25
  * Returns undefined when none of the three vars are set (root invocation).
11
26
  */
12
27
  export declare function readInheritedTrace(): TraceContext | undefined;
28
+ /**
29
+ * Read the pre-assigned task id carried only by a detached runner.
30
+ *
31
+ * This is deliberately separate from readInheritedTrace(): trace variables
32
+ * describe the caller's chain and must not be used as this task's identity.
33
+ */
34
+ export declare function readRunnerAssignment(): string | undefined;
35
+ /** Return true only for the final detached runner process. */
36
+ export declare function isDetachedRunner(): boolean;
@@ -1,25 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readInheritedTrace = readInheritedTrace;
4
- /**
5
- * Read cross-process trace context from inherited environment variables.
6
- *
7
- * This is the ONLY place in the CLI that reads CREWX_PARENT_TASK_ID /
8
- * CREWX_TRACE_ID / CREWX_CALLER_AGENT_ID. The values are passed as
9
- * options.trace into crewx.query/execute so the SDK's ALS takes over
10
- * from there — no direct env reads inside SDK code.
11
- *
12
- * Returns undefined when none of the three vars are set (root invocation).
13
- */
14
- function readInheritedTrace() {
15
- const parentTaskId = process.env['CREWX_PARENT_TASK_ID'] || null;
16
- const rootTraceId = process.env['CREWX_TRACE_ID'] || null;
17
- const callerAgentId = process.env['CREWX_CALLER_AGENT_ID'] || null;
18
- if (!parentTaskId && !rootTraceId && !callerAgentId)
19
- return undefined;
20
- return {
21
- parentTaskId,
22
- rootTraceId: rootTraceId ?? (parentTaskId ?? ''),
23
- callerAgentId,
24
- };
25
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.consumeInheritedRunnerIdentity=t;exports.resetInheritedRunnerIdentityForTests=d;exports.readInheritedTrace=u;exports.readRunnerAssignment=i;exports.isDetachedRunner=c;let n;function t(){if(n!==void 0)return n;const e=process.env["CREWX_ASSIGNED_TASK_ID"]?.trim()||void 0;const r=process.env["CREWX_DETACHED_RUNNER"]==="1";delete process.env["CREWX_ASSIGNED_TASK_ID"];delete process.env["CREWX_DETACHED_RUNNER"];n={assignedTaskId:e,detachedRunner:r};return n}function d(){n=void 0}function u(){const e=process.env["CREWX_PARENT_TASK_ID"]||null;const r=process.env["CREWX_TRACE_ID"]||null;const s=process.env["CREWX_CALLER_AGENT_ID"]||null;if(!e&&!r&&!s)return void 0;return{parentTaskId:e,rootTraceId:r??(e??""),callerAgentId:s}}function i(){return t().assignedTaskId}function c(){return t().detachedRunner}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Finds the installed product root from the CLI entry file that is running.
3
+ * The real CLI path is walked to the first package named `crewx`, which must
4
+ * contain the compiled bundle helper. cwd and environment are deliberately ignored.
5
+ */
6
+ export declare function resolveProductRootFromCliEntry(cliEntryPath: string | undefined): string | undefined;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.resolveProductRootFromCliEntry=c;const t=require("node:fs");const n=require("node:path");const d=(0,n.join)("dist-server","common","product-app-bundle.js");function c(r){if(typeof r!=="string"||r.trim().length===0)return void 0;let o;try{o=(0,t.realpathSync)(r)}catch{return void 0}let e=(0,n.dirname)(o);while(true){try{const u=JSON.parse((0,t.readFileSync)((0,n.join)(e,"package.json"),"utf8"));if(u.name==="crewx"){return(0,t.existsSync)((0,n.join)(e,d))?e:void 0}}catch{}const i=(0,n.dirname)(e);if(i===e)return void 0;e=i}return void 0}
@@ -0,0 +1,24 @@
1
+ import type { CrewxExecutableResolution } from '@crewx/sdk';
2
+ type PricingInitializer = () => Promise<unknown> | unknown;
3
+ export interface SdkLike {
4
+ resolveCrewxCli?: () => string;
5
+ resolveCrewxCliArgv?: () => CrewxExecutableResolution;
6
+ resolveCrewxWorkspace?: () => string;
7
+ initPricingRemote?: PricingInitializer;
8
+ }
9
+ export interface SdkCompat {
10
+ resolveCrewxCli(): string;
11
+ resolveCrewxCliArgv(): CrewxExecutableResolution;
12
+ resolveCrewxWorkspace(): string;
13
+ initPricingRemote(): void;
14
+ }
15
+ /**
16
+ * Create the CLI bootstrap capability accessor for the installed SDK.
17
+ *
18
+ * SDK exports are additive across compatible majors, so an older SDK may not
19
+ * expose every capability that a newer CLI knows about. Optional capabilities
20
+ * are checked here rather than at each bootstrap call site.
21
+ */
22
+ export declare function createSdkCompat(sdkLike?: SdkLike): SdkCompat;
23
+ export declare const sdkCompat: SdkCompat;
24
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";var l=exports&&exports.__createBinding||(Object.create?(function(e,r,t,n){if(n===void 0)n=t;var i=Object.getOwnPropertyDescriptor(r,t);if(!i||("get"in i?!r.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return r[t]}}}Object.defineProperty(e,n,i)}):(function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}));var u=exports&&exports.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}):function(e,r){e["default"]=r});var c=exports&&exports.__importStar||(function(){var e=function(r){e=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))n[n.length]=i;return n};return e(r)};return function(r){if(r&&r.__esModule)return r;var t={};if(r!=null){for(var n=e(r),i=0;i<n.length;i++)if(n[i]!=="default")l(t,r,n[i])}u(t,r);return t}})();Object.defineProperty(exports,"__esModule",{value:true});exports.sdkCompat=void 0;exports.createSdkCompat=o;const a=c(require("@crewx/sdk"));function s(e){const r=a.formatCrewxExecutableArgv;if(typeof r==="function")return r(e);if(process.platform==="win32"){return e.map(t=>{const n=t.replace(/(\\*)"/g,'$1$1\\"').replace(/(\\+)$/g,"$1$1");return`"${n}"`}).join(" ")}return e.map(t=>`'${t.replace(/'/g,`'\\''`)}'`).join(" ")}const f="crewx";function v(){return{ok:false,reason:"The installed SDK does not expose the argv-based CrewX CLI resolver.",attempts:[{stage:"env",reason:"argv resolver capability is unavailable"},{stage:"self",reason:"argv resolver capability is unavailable"},{stage:"workspace",reason:"argv resolver capability is unavailable"},{stage:"module",reason:"argv resolver capability is unavailable"},{stage:"path",reason:"argv resolver capability is unavailable"}]}}function o(e=a){return{resolveCrewxCli:()=>{const r=process.env.CREWX_CLI;if(r?.trim())return r;if(typeof e.resolveCrewxCliArgv==="function"){const t=e.resolveCrewxCliArgv();if(t.ok)return s(t.argv)}if(typeof e.resolveCrewxCli==="function"){const t=e.resolveCrewxCli();if(t.trim())return t}return f},resolveCrewxCliArgv:()=>{if(typeof e.resolveCrewxCliArgv==="function"){return e.resolveCrewxCliArgv()}return v()},resolveCrewxWorkspace:()=>{if(typeof e.resolveCrewxWorkspace==="function"){return e.resolveCrewxWorkspace()}return process.env.CREWX_WORKSPACE||process.cwd()},initPricingRemote:()=>{if(typeof e.initPricingRemote!=="function")return;try{void Promise.resolve(e.initPricingRemote()).catch(()=>void 0)}catch{}}}}exports.sdkCompat=o();
@@ -1,28 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CLI_VERSION = void 0;
4
- const fs_1 = require("fs");
5
- const path_1 = require("path");
6
- /**
7
- * Return the installed @crewx/cli package version.
8
- *
9
- * Resolution strategy (mirrors cli-bak version.ts):
10
- * 1. Read the package.json that is co-located with the compiled dist tree.
11
- * At runtime __dirname resolves to dist/utils/, so ../../package.json
12
- * reaches the package root — both in development and in an npm-installed
13
- * deployment (node_modules/@crewx/cli/package.json).
14
- * 2. Fall back to '0.0.0' on any I/O or parse error.
15
- *
16
- * Result is cached in the module-level constant to avoid repeated disk reads.
17
- */
18
- function readVersion() {
19
- try {
20
- const pkgPath = (0, path_1.join)(__dirname, '../../package.json');
21
- const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf8'));
22
- return pkg.version ?? '0.0.0';
23
- }
24
- catch {
25
- return '0.0.0';
26
- }
27
- }
28
- exports.CLI_VERSION = readVersion();
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CLI_VERSION=void 0;const t=require("fs");const n=require("path");function o(){try{const e=(0,n.join)(__dirname,"../../package.json");const r=JSON.parse((0,t.readFileSync)(e,"utf8"));return r.version??"0.0.0"}catch{return"0.0.0"}}exports.CLI_VERSION=o();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/cli",
3
- "version": "0.9.0-rc.18",
3
+ "version": "0.9.0-rc.180",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -23,18 +23,22 @@
23
23
  "dependencies": {
24
24
  "@crewx/adapter-slack": "0.1.4",
25
25
  "better-sqlite3": "*",
26
+ "dotenv": "17.2.3",
26
27
  "isomorphic-git": "1.37.1",
27
- "@crewx/search": "0.1.10",
28
- "@crewx/memory": "0.1.23",
29
- "@crewx/doc": "0.1.9",
30
- "@crewx/sdk": "0.9.0-rc.18",
31
- "@crewx/wbs": "0.1.10",
32
- "@crewx/cron": "0.1.10",
33
- "@crewx/workflow": "0.3.22-rc.64",
34
- "@crewx/skill": "0.1.20",
35
- "@crewx/wi": "0.1.10-rc.38",
36
- "@crewx/chromex": "0.1.0",
37
- "@crewx/shared": "0.0.6"
28
+ "@crewx/sdk": "0.9.0-rc.180",
29
+ "@crewx/search": "0.1.10-rc.176",
30
+ "@crewx/knowledge-core": "0.1.17-rc.190",
31
+ "@crewx/memory": "0.1.23-rc.197",
32
+ "@crewx/doc": "0.1.9-rc.173",
33
+ "@crewx/wbs": "0.1.10-rc.206",
34
+ "@crewx/cron": "0.1.10-rc.215",
35
+ "@crewx/workflow": "0.3.22-rc.226",
36
+ "@crewx/skill": "0.1.20-rc.74",
37
+ "@crewx/chromex": "0.1.0-rc.213",
38
+ "@crewx/wi": "0.1.10-rc.200",
39
+ "@crewx/app": "0.1.0-rc.61",
40
+ "@crewx/notify": "0.1.0-rc.151",
41
+ "@crewx/shared": "0.0.6-rc.95"
38
42
  },
39
43
  "devDependencies": {
40
44
  "@types/better-sqlite3": "*",