noskills 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1123
- package/dist/launcher.js +162 -0
- package/dist/noskills.js +38 -0
- package/package.json +31 -16
- package/noskills.js +0 -146
- package/ts/chunks/ajan-bridge-6UUIUFAV.js +0 -1
- package/ts/chunks/anthropic-ICVQ5GK6.js +0 -1
- package/ts/chunks/approve-R7MCYHCS.js +0 -1
- package/ts/chunks/ask-GBLFPNFX.js +0 -2
- package/ts/chunks/block-YEKLMXHR.js +0 -1
- package/ts/chunks/cancel-7NS4WM2N.js +0 -1
- package/ts/chunks/chunk-2CLD527I.js +0 -1
- package/ts/chunks/chunk-34AWV7DB.js +0 -1
- package/ts/chunks/chunk-3M26Y3NG.js +0 -27
- package/ts/chunks/chunk-3QVRJO3V.js +0 -1
- package/ts/chunks/chunk-5ALJRBMW.js +0 -22
- package/ts/chunks/chunk-5NMDE2VZ.js +0 -4
- package/ts/chunks/chunk-6BKTY7SA.js +0 -4
- package/ts/chunks/chunk-6M7PCVUR.js +0 -1
- package/ts/chunks/chunk-6O2RXYTM.js +0 -3
- package/ts/chunks/chunk-7DIQYKPL.js +0 -3
- package/ts/chunks/chunk-7J6R2D2K.js +0 -2
- package/ts/chunks/chunk-ATNTR7M5.js +0 -1
- package/ts/chunks/chunk-AW3XJGEP.js +0 -1
- package/ts/chunks/chunk-BRC46A3N.js +0 -39
- package/ts/chunks/chunk-C5LYQDQH.js +0 -368
- package/ts/chunks/chunk-CCYWFSXR.js +0 -3
- package/ts/chunks/chunk-CL55MNGD.js +0 -1
- package/ts/chunks/chunk-CSP2GUD4.js +0 -29
- package/ts/chunks/chunk-D2UKX2VW.js +0 -2
- package/ts/chunks/chunk-DGYDUGTM.js +0 -1
- package/ts/chunks/chunk-FB3Z7XYQ.js +0 -1
- package/ts/chunks/chunk-FLLYK5FU.js +0 -1
- package/ts/chunks/chunk-GCPGG4YB.js +0 -1
- package/ts/chunks/chunk-HISXAZ4Y.js +0 -1
- package/ts/chunks/chunk-HLDPASM6.js +0 -3
- package/ts/chunks/chunk-HNQA5O2S.js +0 -2
- package/ts/chunks/chunk-HUP7XWW6.js +0 -1
- package/ts/chunks/chunk-I4Z2RF7L.js +0 -31
- package/ts/chunks/chunk-J3XNDEMU.js +0 -4
- package/ts/chunks/chunk-K6FVY52W.js +0 -5
- package/ts/chunks/chunk-KQJGXVWX.js +0 -91
- package/ts/chunks/chunk-M4U4Y3XQ.js +0 -7
- package/ts/chunks/chunk-M6CAJL36.js +0 -1
- package/ts/chunks/chunk-MPHTBN7E.js +0 -1
- package/ts/chunks/chunk-NYIFCLEG.js +0 -1
- package/ts/chunks/chunk-RRDWQKZY.js +0 -1
- package/ts/chunks/chunk-RVNSKPFL.js +0 -1
- package/ts/chunks/chunk-S5F2DAAG.js +0 -5
- package/ts/chunks/chunk-SCYP2G2T.js +0 -3
- package/ts/chunks/chunk-SWP6BJR6.js +0 -147
- package/ts/chunks/chunk-SWRVSRYY.js +0 -5
- package/ts/chunks/chunk-T2X4E35X.js +0 -1
- package/ts/chunks/chunk-TDLTCTV4.js +0 -1
- package/ts/chunks/chunk-TKBGNLNV.js +0 -1
- package/ts/chunks/chunk-UY4YFVSW.js +0 -3
- package/ts/chunks/chunk-V5ZXCJPI.js +0 -2
- package/ts/chunks/chunk-W46BJM2F.js +0 -1
- package/ts/chunks/chunk-W7KQFMHV.js +0 -1
- package/ts/chunks/chunk-XGRZPTAD.js +0 -24
- package/ts/chunks/chunk-XTQFSF6C.js +0 -1
- package/ts/chunks/chunk-YN3SHWBR.js +0 -1
- package/ts/chunks/chunk-ZAY6LSJD.js +0 -2
- package/ts/chunks/chunk-ZGVXR3EC.js +0 -8
- package/ts/chunks/chunk-ZW5C5IGT.js +0 -32
- package/ts/chunks/claude-code-J2V5WSGZ.js +0 -1
- package/ts/chunks/concern-EDWQHU4H.js +0 -1
- package/ts/chunks/config-E7BDBHPK.js +0 -1
- package/ts/chunks/decision-ledger-5QXKZSV2.js +0 -1
- package/ts/chunks/delegate-LVQQ3GCV.js +0 -1
- package/ts/chunks/diagrams-2F5ZYXA7.js +0 -1
- package/ts/chunks/diagrams-H62JGTIS.js +0 -1
- package/ts/chunks/dist-3MH5UCQU.js +0 -12
- package/ts/chunks/done-U3TOSZIX.js +0 -1
- package/ts/chunks/followup-J2HJU3ZT.js +0 -1
- package/ts/chunks/free-73WMLMCT.js +0 -1
- package/ts/chunks/gemini-GA6P4M7D.js +0 -1
- package/ts/chunks/init-6CVDGRY2.js +0 -1
- package/ts/chunks/invoke-hook-2TMKWL7I.js +0 -15
- package/ts/chunks/kiro-BJSKSAUC.js +0 -1
- package/ts/chunks/learn-7Q2VWZMI.js +0 -7
- package/ts/chunks/ledger-XR4AHZRX.js +0 -2
- package/ts/chunks/list-CUQCPXZH.js +0 -1
- package/ts/chunks/manager-WTLJ5C2I.js +0 -3
- package/ts/chunks/mod-BZA5TFW7.js +0 -1
- package/ts/chunks/mod-RWA5ZPYH.js +0 -1
- package/ts/chunks/mod-X372UNSQ.js +0 -1
- package/ts/chunks/mod-XVE4ZWPY.js +0 -1
- package/ts/chunks/multipart-parser-DKDFOZKD.js +0 -2
- package/ts/chunks/next-CEYZSYGB.js +0 -20
- package/ts/chunks/node-33JV5VS3.js +0 -15
- package/ts/chunks/node-XYP2DQHR.js +0 -74
- package/ts/chunks/node-ZSGIX7K3.js +0 -1
- package/ts/chunks/ollama-X6OGN5BW.js +0 -1
- package/ts/chunks/openai-TV7KLQ2C.js +0 -1
- package/ts/chunks/openai-YPM2E7QS.js +0 -30
- package/ts/chunks/opencode-AK6WWZRF.js +0 -1
- package/ts/chunks/pack-EOUSZGJT.js +0 -5
- package/ts/chunks/plan-export-ZBINRAAS.js +0 -3
- package/ts/chunks/purge-GPMC5A6Y.js +0 -5
- package/ts/chunks/reopen-LPVNZN5I.js +0 -1
- package/ts/chunks/reset-RNLPXGWQ.js +0 -1
- package/ts/chunks/review-ZGAY5XCN.js +0 -1
- package/ts/chunks/rule-SNBQ4VZD.js +0 -6
- package/ts/chunks/run-4TDP4C7Z.js +0 -3
- package/ts/chunks/sdk-MEVPL5WT.js +0 -1
- package/ts/chunks/session-J7TSLNEH.js +0 -1
- package/ts/chunks/spec-3NSPFDIC.js +0 -1
- package/ts/chunks/src-HXQVVTGQ.js +0 -3
- package/ts/chunks/status-DIEA2OGR.js +0 -1
- package/ts/chunks/sync-HZNKILSP.js +0 -1
- package/ts/chunks/validate-MWHDOF2F.js +0 -1
- package/ts/chunks/vertexai-ARXI4AMJ.js +0 -1
- package/ts/chunks/watch-P6HABMAS.js +0 -7
- package/ts/chunks/web-BMIC3VJQ.js +0 -1
- package/ts/chunks/wontfix-6UKEYTVB.js +0 -1
- package/ts/noskills.js +0 -2
package/dist/launcher.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Copyright 2023-present Eser Ozvataf and other contributors. All rights reserved. Apache-2.0 license.
|
|
2
|
+
/**
|
|
3
|
+
* The launcher of an npm package that ships a Go binary.
|
|
4
|
+
*
|
|
5
|
+
* The npm package holds no binary itself: it runs the one npm installed with
|
|
6
|
+
* it, from the optional dependency `@eserstack/<command>-<platform>-<arch>`
|
|
7
|
+
* that matches this machine, with the same arguments, standard streams and
|
|
8
|
+
* exit code (TASK-261).
|
|
9
|
+
*
|
|
10
|
+
* It runs only under Node, as an npm bin, so it uses the node: builtins
|
|
11
|
+
* directly and imports nothing else: it starts before every hook that calls
|
|
12
|
+
* `npx noskills` or `npx eser`, and stays small. pkg/@eserstack/noskills-bin
|
|
13
|
+
* and pkg/@eserstack/eser-bin carry the same file; a test in each keeps them
|
|
14
|
+
* equal.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as childProcess from "node:child_process";
|
|
19
|
+
import * as fs from "node:fs";
|
|
20
|
+
import * as nodeModule from "node:module";
|
|
21
|
+
import * as path from "node:path";
|
|
22
|
+
// The process of the Node that runs the launcher.
|
|
23
|
+
const process = globalThis.process;
|
|
24
|
+
/**
|
|
25
|
+
* Finds the binary of the platform package for `platform` and `arch`.
|
|
26
|
+
* `resolvePackageJson` returns the path of a package's package.json, or
|
|
27
|
+
* throws when the package is not installed.
|
|
28
|
+
*/
|
|
29
|
+
export const findBinary = (launcher, platform, arch, resolvePackageJson, exists) => {
|
|
30
|
+
const { command } = launcher;
|
|
31
|
+
const key = `${platform}-${arch}`;
|
|
32
|
+
const name = launcher.platformPackages[key];
|
|
33
|
+
if (name === undefined) {
|
|
34
|
+
return {
|
|
35
|
+
kind: "missing",
|
|
36
|
+
message: `${command}: no prebuilt binary for ${key}. The npm package ships one for ${Object.keys(launcher.platformPackages).join(", ")}; on another platform, build ${launcher.source} from https://github.com/eser/stack with Go.`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
let manifest;
|
|
40
|
+
try {
|
|
41
|
+
manifest = resolvePackageJson(name);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return {
|
|
45
|
+
kind: "missing",
|
|
46
|
+
message: `${command}: the platform package ${name} is not installed. npm installs it as an optional dependency of ${command}; reinstall ${command} without --omit=optional or --no-optional.`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const binary = path.join(path.dirname(manifest), platform === "win32" ? `${command}.exe` : command);
|
|
50
|
+
if (!exists(binary)) {
|
|
51
|
+
return {
|
|
52
|
+
kind: "missing",
|
|
53
|
+
message: `${command}: ${name} has no binary at ${binary}; reinstall ${command}.`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return { kind: "found", path: binary };
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The execute bits for user, group and others, which npm pack keeps on the
|
|
60
|
+
* binary and pnpm pack drops (TASK-368).
|
|
61
|
+
*/
|
|
62
|
+
export const EXECUTE_BITS = 0o111;
|
|
63
|
+
/**
|
|
64
|
+
* Makes the binary executable when it is not. pnpm pack writes the binary of
|
|
65
|
+
* a platform package at mode 0644, and the release publishes those packages
|
|
66
|
+
* with pnpm, so an installed binary may lack the execute bits; the launcher
|
|
67
|
+
* adds them to its mode before it runs it. Windows has no execute bit.
|
|
68
|
+
*/
|
|
69
|
+
export const ensureExecutable = (launcher, binary, platform, access) => {
|
|
70
|
+
if (platform === "win32" || access.isExecutable(binary)) {
|
|
71
|
+
return { kind: "ready" };
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
access.chmod(binary, access.mode(binary) | EXECUTE_BITS);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
// A read-only install, or one another user owns, cannot be changed.
|
|
78
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
79
|
+
return {
|
|
80
|
+
kind: "failed",
|
|
81
|
+
message: `${launcher.command}: ${binary} is not executable and the launcher cannot change its mode (${reason}). Run \`chmod +x ${binary}\` as the owner of the install (with sudo for a global one), or reinstall ${launcher.command}.`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return { kind: "ready" };
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The exit code the launcher ends with: the binary's, or the shell's
|
|
88
|
+
* 128 + n for a binary that a signal ended.
|
|
89
|
+
*/
|
|
90
|
+
export const exitCodeOf = (code, signal) => {
|
|
91
|
+
if (code !== null) {
|
|
92
|
+
return code;
|
|
93
|
+
}
|
|
94
|
+
const number = signal === null ? undefined : nodeSignalNumber(signal);
|
|
95
|
+
return number === undefined ? 1 : 128 + number;
|
|
96
|
+
};
|
|
97
|
+
const nodeSignalNumber = (signal) => {
|
|
98
|
+
const numbers = {
|
|
99
|
+
SIGHUP: 1,
|
|
100
|
+
SIGINT: 2,
|
|
101
|
+
SIGQUIT: 3,
|
|
102
|
+
SIGKILL: 9,
|
|
103
|
+
SIGTERM: 15,
|
|
104
|
+
};
|
|
105
|
+
return numbers[signal];
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Runs the binary with this process's arguments and `env` added to its
|
|
109
|
+
* environment, and exits with its code. `from` is the launcher bin's
|
|
110
|
+
* `import.meta.url`, where the platform packages are resolved from.
|
|
111
|
+
*/
|
|
112
|
+
export const main = (launcher, from, env) => {
|
|
113
|
+
const require = nodeModule.createRequire(from);
|
|
114
|
+
const lookup = findBinary(launcher, process.platform, process.arch, (name) => require.resolve(`${name}/package.json`), (file) => fs.existsSync(file));
|
|
115
|
+
if (lookup.kind === "missing") {
|
|
116
|
+
process.stderr.write(`${lookup.message}\n`);
|
|
117
|
+
process.exitCode = 1;
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const preparation = ensureExecutable(launcher, lookup.path, process.platform, {
|
|
121
|
+
isExecutable: (file) => {
|
|
122
|
+
try {
|
|
123
|
+
fs.accessSync(file, fs.constants.X_OK);
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
mode: (file) => fs.statSync(file).mode,
|
|
131
|
+
chmod: (file, mode) => fs.chmodSync(file, mode),
|
|
132
|
+
});
|
|
133
|
+
if (preparation.kind === "failed") {
|
|
134
|
+
process.stderr.write(`${preparation.message}\n`);
|
|
135
|
+
process.exitCode = 1;
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const child = childProcess.spawn(lookup.path, process.argv.slice(2), {
|
|
139
|
+
stdio: "inherit",
|
|
140
|
+
env: { ...process.env, ...env },
|
|
141
|
+
});
|
|
142
|
+
// The launcher waits for the binary, which handles the signals itself (a
|
|
143
|
+
// `noskills run` turn is cancelled cleanly), so a signal is passed on and
|
|
144
|
+
// does not end the launcher. A terminal's Ctrl+C reaches the binary twice
|
|
145
|
+
// that way, which it ignores after the first. On Windows the console gives
|
|
146
|
+
// Ctrl+C to the binary itself, and kill() would end it at once.
|
|
147
|
+
const forward = (signal) => () => {
|
|
148
|
+
if (process.platform !== "win32") {
|
|
149
|
+
child.kill(signal);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
153
|
+
process.on(signal, forward(signal));
|
|
154
|
+
}
|
|
155
|
+
child.on("error", (error) => {
|
|
156
|
+
process.stderr.write(`${launcher.command}: cannot run ${lookup.path}: ${error.message}\n`);
|
|
157
|
+
process.exit(1);
|
|
158
|
+
});
|
|
159
|
+
child.on("exit", (code, signal) => {
|
|
160
|
+
process.exit(exitCodeOf(code, signal));
|
|
161
|
+
});
|
|
162
|
+
};
|
package/dist/noskills.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env -S node
|
|
2
|
+
// Copyright 2023-present Eser Ozvataf and other contributors. All rights reserved. Apache-2.0 license.
|
|
3
|
+
/**
|
|
4
|
+
* The `noskills` bin of the npm package `noskills`.
|
|
5
|
+
*
|
|
6
|
+
* It runs the Go noskills binary of this machine's platform package
|
|
7
|
+
* (launcher.ts). The binary forwards the commands that are not ported to Go
|
|
8
|
+
* yet (`watch`, `manager`, `web`) to the TypeScript CLI, which this package
|
|
9
|
+
* depends on as @eserstack/noskills at the same version; the launcher names
|
|
10
|
+
* that CLI's entry point in NOSKILLS_TS_BUNDLE, and the binary runs it with
|
|
11
|
+
* node.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* npx noskills <command> [options]
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as url from "node:url";
|
|
19
|
+
import * as launcher from "./launcher.js";
|
|
20
|
+
/** The launcher of the Go noskills. */
|
|
21
|
+
export const NOSKILLS = {
|
|
22
|
+
command: "noskills",
|
|
23
|
+
platformPackages: {
|
|
24
|
+
"darwin-arm64": "@eserstack/noskills-darwin-arm64",
|
|
25
|
+
"darwin-x64": "@eserstack/noskills-darwin-x64",
|
|
26
|
+
"linux-arm64": "@eserstack/noskills-linux-arm64",
|
|
27
|
+
"linux-x64": "@eserstack/noskills-linux-x64",
|
|
28
|
+
"win32-x64": "@eserstack/noskills-win32-x64",
|
|
29
|
+
},
|
|
30
|
+
source: "cmd/noskills",
|
|
31
|
+
};
|
|
32
|
+
/** The environment variable that names the TypeScript CLI's entry point. */
|
|
33
|
+
export const TS_CLI_ENV = "NOSKILLS_TS_BUNDLE";
|
|
34
|
+
/** The entry point of the TypeScript CLI, the `.` export of @eserstack/noskills. */
|
|
35
|
+
export const tsCLIEntry = () => url.fileURLToPath(import.meta.resolve("@eserstack/noskills"));
|
|
36
|
+
if (import.meta.main) {
|
|
37
|
+
launcher.main(NOSKILLS, import.meta.url, { [TS_CLI_ENV]: tsCLIEntry() });
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noskills",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
|
+
"description": "The noskills command: spec-driven workflow for coding agents",
|
|
5
|
+
"license": "Apache-2.0",
|
|
4
6
|
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/eser/stack",
|
|
10
|
+
"directory": "pkg/@eserstack/noskills-bin"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/eser/stack/tree/main/pkg/@eserstack/noskills",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/eser/stack/issues"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/noskills.js",
|
|
18
|
+
"dist/launcher.js"
|
|
19
|
+
],
|
|
5
20
|
"bin": {
|
|
6
|
-
"noskills": "./noskills.js"
|
|
21
|
+
"noskills": "./dist/noskills.js"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@eserstack/noskills": "5.1.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@eserstack/standards": "5.1.0",
|
|
28
|
+
"@eserstack/test-kit": "5.1.0"
|
|
7
29
|
},
|
|
8
30
|
"optionalDependencies": {
|
|
9
|
-
"@eserstack/
|
|
10
|
-
"@eserstack/
|
|
11
|
-
"@eserstack/
|
|
12
|
-
"@eserstack/
|
|
13
|
-
"@eserstack/
|
|
14
|
-
"@eserstack/ajan-wasm": "5.0.0",
|
|
15
|
-
"@eserstack/noskills-darwin-arm64": "5.0.0",
|
|
16
|
-
"@eserstack/noskills-darwin-x64": "5.0.0",
|
|
17
|
-
"@eserstack/noskills-linux-arm64": "5.0.0",
|
|
18
|
-
"@eserstack/noskills-linux-x64": "5.0.0",
|
|
19
|
-
"@eserstack/noskills-win32-x64": "5.0.0"
|
|
31
|
+
"@eserstack/noskills-darwin-arm64": "5.1.0",
|
|
32
|
+
"@eserstack/noskills-darwin-x64": "5.1.0",
|
|
33
|
+
"@eserstack/noskills-linux-arm64": "5.1.0",
|
|
34
|
+
"@eserstack/noskills-linux-x64": "5.1.0",
|
|
35
|
+
"@eserstack/noskills-win32-x64": "5.1.0"
|
|
20
36
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"url": "https://github.com/eser/stack"
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "node ../../../etc/scripts/build-library.ts"
|
|
24
39
|
}
|
|
25
40
|
}
|
package/noskills.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// pkg/@eserstack/noskills/scripts/npm-launcher.ts
|
|
4
|
-
import * as childProcess from "node:child_process";
|
|
5
|
-
import * as fs from "node:fs";
|
|
6
|
-
import * as nodeModule from "node:module";
|
|
7
|
-
import * as path from "node:path";
|
|
8
|
-
import * as url from "node:url";
|
|
9
|
-
var process = globalThis.process;
|
|
10
|
-
var PLATFORM_PACKAGES = {
|
|
11
|
-
"darwin-arm64": "@eserstack/noskills-darwin-arm64",
|
|
12
|
-
"darwin-x64": "@eserstack/noskills-darwin-x64",
|
|
13
|
-
"linux-arm64": "@eserstack/noskills-linux-arm64",
|
|
14
|
-
"linux-x64": "@eserstack/noskills-linux-x64",
|
|
15
|
-
"win32-x64": "@eserstack/noskills-win32-x64"
|
|
16
|
-
};
|
|
17
|
-
var TS_BUNDLE_ENV = "NOSKILLS_TS_BUNDLE";
|
|
18
|
-
var findBinary = (platform, arch, resolvePackageJson, exists) => {
|
|
19
|
-
const key = `${platform}-${arch}`;
|
|
20
|
-
const name = PLATFORM_PACKAGES[key];
|
|
21
|
-
if (name === void 0) {
|
|
22
|
-
return {
|
|
23
|
-
kind: "missing",
|
|
24
|
-
message: `noskills: no prebuilt binary for ${key}. The npm package ships one for ${Object.keys(
|
|
25
|
-
PLATFORM_PACKAGES
|
|
26
|
-
).join(
|
|
27
|
-
", "
|
|
28
|
-
)}; on another platform, build cmd/noskills from https://github.com/eser/stack with Go.`
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
let manifest;
|
|
32
|
-
try {
|
|
33
|
-
manifest = resolvePackageJson(name);
|
|
34
|
-
} catch {
|
|
35
|
-
return {
|
|
36
|
-
kind: "missing",
|
|
37
|
-
message: `noskills: the platform package ${name} is not installed. npm installs it as an optional dependency of noskills; reinstall noskills without --omit=optional or --no-optional.`
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const binary = path.join(
|
|
41
|
-
path.dirname(manifest),
|
|
42
|
-
platform === "win32" ? "noskills.exe" : "noskills"
|
|
43
|
-
);
|
|
44
|
-
if (!exists(binary)) {
|
|
45
|
-
return {
|
|
46
|
-
kind: "missing",
|
|
47
|
-
message: `noskills: ${name} has no binary at ${binary}; reinstall noskills.`
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return { kind: "found", path: binary };
|
|
51
|
-
};
|
|
52
|
-
var EXECUTE_BITS = 73;
|
|
53
|
-
var ensureExecutable = (binary, platform, access) => {
|
|
54
|
-
if (platform === "win32" || access.isExecutable(binary)) {
|
|
55
|
-
return { kind: "ready" };
|
|
56
|
-
}
|
|
57
|
-
try {
|
|
58
|
-
access.chmod(binary, access.mode(binary) | EXECUTE_BITS);
|
|
59
|
-
} catch (error) {
|
|
60
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
61
|
-
return {
|
|
62
|
-
kind: "failed",
|
|
63
|
-
message: `noskills: ${binary} is not executable and the launcher cannot change its mode (${reason}). Run \`chmod +x ${binary}\` as the owner of the install (with sudo for a global one), or reinstall noskills.`
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return { kind: "ready" };
|
|
67
|
-
};
|
|
68
|
-
var exitCodeOf = (code, signal) => {
|
|
69
|
-
if (code !== null) {
|
|
70
|
-
return code;
|
|
71
|
-
}
|
|
72
|
-
const number = signal === null ? void 0 : nodeSignalNumber(signal);
|
|
73
|
-
return number === void 0 ? 1 : 128 + number;
|
|
74
|
-
};
|
|
75
|
-
var nodeSignalNumber = (signal) => {
|
|
76
|
-
const numbers = {
|
|
77
|
-
SIGHUP: 1,
|
|
78
|
-
SIGINT: 2,
|
|
79
|
-
SIGQUIT: 3,
|
|
80
|
-
SIGKILL: 9,
|
|
81
|
-
SIGTERM: 15
|
|
82
|
-
};
|
|
83
|
-
return numbers[signal];
|
|
84
|
-
};
|
|
85
|
-
var main = () => {
|
|
86
|
-
const require2 = nodeModule.createRequire(import.meta.url);
|
|
87
|
-
const lookup = findBinary(
|
|
88
|
-
process.platform,
|
|
89
|
-
process.arch,
|
|
90
|
-
(name) => require2.resolve(`${name}/package.json`),
|
|
91
|
-
(file) => fs.existsSync(file)
|
|
92
|
-
);
|
|
93
|
-
if (lookup.kind === "missing") {
|
|
94
|
-
process.stderr.write(`${lookup.message}
|
|
95
|
-
`);
|
|
96
|
-
process.exitCode = 1;
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const preparation = ensureExecutable(lookup.path, process.platform, {
|
|
100
|
-
isExecutable: (file) => {
|
|
101
|
-
try {
|
|
102
|
-
fs.accessSync(file, fs.constants.X_OK);
|
|
103
|
-
return true;
|
|
104
|
-
} catch {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
mode: (file) => fs.statSync(file).mode,
|
|
109
|
-
chmod: (file, mode) => fs.chmodSync(file, mode)
|
|
110
|
-
});
|
|
111
|
-
if (preparation.kind === "failed") {
|
|
112
|
-
process.stderr.write(`${preparation.message}
|
|
113
|
-
`);
|
|
114
|
-
process.exitCode = 1;
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const here = path.dirname(url.fileURLToPath(import.meta.url));
|
|
118
|
-
const child = childProcess.spawn(lookup.path, process.argv.slice(2), {
|
|
119
|
-
stdio: "inherit",
|
|
120
|
-
env: {
|
|
121
|
-
...process.env,
|
|
122
|
-
[TS_BUNDLE_ENV]: path.join(here, "ts", "noskills.js")
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
const forward = (signal) => () => {
|
|
126
|
-
if (process.platform !== "win32") {
|
|
127
|
-
child.kill(signal);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
131
|
-
process.on(signal, forward(signal));
|
|
132
|
-
}
|
|
133
|
-
child.on("error", (error) => {
|
|
134
|
-
process.stderr.write(
|
|
135
|
-
`noskills: cannot run ${lookup.path}: ${error.message}
|
|
136
|
-
`
|
|
137
|
-
);
|
|
138
|
-
process.exit(1);
|
|
139
|
-
});
|
|
140
|
-
child.on("exit", (code, signal) => {
|
|
141
|
-
process.exit(exitCodeOf(code, signal));
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// pkg/@eserstack/noskills/scripts/noskills-launcher.ts
|
|
146
|
-
main();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./chunk-MPHTBN7E.js";import"./chunk-YN3SHWBR.js";import"./chunk-CL55MNGD.js";import"./chunk-HISXAZ4Y.js";export{a as AjanBridgeModel,b as AjanBridgeModelFactory,c as createBridgeFactories,e as getBridgeLoadError,d as tryLoadBridgeFactories};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-W46BJM2F.js";import"./chunk-GCPGG4YB.js";import"./chunk-T2X4E35X.js";import"./chunk-YN3SHWBR.js";import"./chunk-CL55MNGD.js";import"./chunk-HISXAZ4Y.js";export{a as AnthropicModel,b as anthropicFactory};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as k}from"./chunk-7DIQYKPL.js";import"./chunk-D2UKX2VW.js";import{a as L,d as N}from"./chunk-HLDPASM6.js";import{h as S}from"./chunk-7J6R2D2K.js";import{L as b,k as x,n as I,z as f}from"./chunk-5ALJRBMW.js";import"./chunk-SWRVSRYY.js";import"./chunk-FLLYK5FU.js";import{c,d as $}from"./chunk-W7KQFMHV.js";import{c as o,d as p,f as n,g as m,k as w,o as v,q as E,r as C}from"./chunk-BRC46A3N.js";import"./chunk-TKBGNLNV.js";import"./chunk-XGRZPTAD.js";import"./chunk-XTQFSF6C.js";import{B as A,F as D,H as u,U as _,r as R,u as y,w as O}from"./chunk-SWP6BJR6.js";import{C as P}from"./chunk-M4U4Y3XQ.js";import{a as g,b as i}from"./chunk-CL55MNGD.js";import"./chunk-HISXAZ4Y.js";var Q=async T=>{let e=v({renderer:C.ansi(),sink:E.stdout()}),{root:r}=await _(),h=await $(r),l=O(T,h);if(!l.ok)return e.writeln(n(l.error)),await e.close(),i({exitCode:1});let t;try{t=await y(r,l.spec,h)}catch(s){let a=s instanceof Error?s.message:String(s);return e.writeln(n(a)),await e.close(),i({exitCode:1})}let V=await A(r);if(t.spec!==null){let s=`${r}/${R.specDir(t.spec)}`;try{await P.fs.stat(s)}catch{return e.writeln(n(`Active spec '${t.spec}' directory not found.`)),e.writeln(p(`Run \`${c(`spec ${t.spec} reset`)}\` to return to idle.`)),await e.close(),i({exitCode:1})}}let d=b(t);if(d.length>0&&(t.phase==="SPEC_PROPOSAL"||t.phase==="DISCOVERY_REFINEMENT")){e.writeln(n(`Cannot approve \u2014 ${d.length} pending delegation(s):`)),e.writeln("");for(let s of d)e.writeln(` ${s.questionId}: delegated to `,o(s.delegatedTo),p(` (pending since ${s.delegatedAt.slice(0,10)})`));return e.writeln(""),e.writeln(p("All delegations must be answered before approval.")),await e.close(),i({exitCode:1})}if(t.phase==="SPEC_PROPOSAL"){if(t.classification===null&&t.spec!==null){let F=(await D(r)).filter(U=>V?.concerns.includes(U.id)??!1);try{await k(r,t,F)}catch{}}let s=await S(r),a=I(t);a=f(a,"SPEC_PROPOSAL","SPEC_APPROVED",s),await u(r,a),a.spec!==null&&(await L(r,a.spec,"approved"),await N(r,a.spec,"approved")),e.writeln(m("\u2714")," Spec approved. Phase: ",w("SPEC_APPROVED")),e.writeln("When ready, run ",o(`${c(`spec ${l.spec} next --answer="start"`)}`)," to begin execution.")}else if(t.phase==="DISCOVERY_REFINEMENT"){let s=await S(r),a=x(t);a=f(a,"DISCOVERY_REFINEMENT","SPEC_PROPOSAL",s),await u(r,a),e.writeln(m("\u2714")," Discovery answers approved. Phase: ",w("SPEC_PROPOSAL")),e.writeln("Review the spec and run ",o(c("approve"))," again to approve.")}else t.phase==="DISCOVERY"&&t.discovery.completed?(e.writeln(p("Discovery complete. Spec draft already generated.")),e.writeln("Review the spec and run ",o(c("approve"))," again when in SPEC_PROPOSAL phase.")):e.writeln(n(`Cannot approve in phase: ${t.phase}`));return await e.close(),g(void 0)};export{Q as main};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as V}from"./chunk-RVNSKPFL.js";import{b as Se}from"./chunk-NYIFCLEG.js";import{a as K,b as C,c as E,d as P,f as T,g as ce,h as ye,j as ue,k as G,l as fe,o as U,p as de,q,r as pe}from"./chunk-BRC46A3N.js";import{b as J,c as k,f as I}from"./chunk-ZAY6LSJD.js";import{C as x}from"./chunk-M4U4Y3XQ.js";import"./chunk-ZW5C5IGT.js";import{e as Ce}from"./chunk-RRDWQKZY.js";import{a as me}from"./chunk-GCPGG4YB.js";import{b as xe}from"./chunk-T2X4E35X.js";import"./chunk-YN3SHWBR.js";import{a as F,b as m,d as W}from"./chunk-CL55MNGD.js";import{d as _}from"./chunk-HISXAZ4Y.js";var f=r=>typeof r=="string"?r.split(".").filter(Boolean):r,w=(r,e=".")=>r.join(e),S=r=>r.join("\0");var B=(r,e)=>r.length<e.length?!1:e.every((t,o)=>r[o]===t);var O=(r,e)=>{let t=typeof e=="string"?[e]:e;return[...r,...t]};var L={};_(L,{configure:()=>er,getEffectiveConfig:()=>ee,getFilterNames:()=>ir,getLoggerCategories:()=>gr,getRegistryState:()=>Xe,getSinkNames:()=>ar,isConfigured:()=>Ze,registerConfigureHook:()=>Z,registerFilter:()=>nr,registerLogger:()=>sr,registerLoggerCacheClear:()=>X,registerSink:()=>rr,reset:()=>Pe,unregisterFilter:()=>or,unregisterSink:()=>tr});var i={Trace:1,Debug:5,Info:9,Notice:10,Warning:13,Error:17,Critical:21,Alert:22,Emergency:23},ve={[i.Trace]:"Trace",[i.Debug]:"Debug",[i.Info]:"Info",[i.Notice]:"Notice",[i.Warning]:"Warning",[i.Error]:"Error",[i.Critical]:"Critical",[i.Alert]:"Alert",[i.Emergency]:"Emergency"};import*as Y from"node:async_hooks";var $,z,Ke=()=>($===void 0&&($=new Y.AsyncLocalStorage),$),Ge=()=>(z===void 0&&(z=new Y.AsyncLocalStorage),z),he,Te,Q=r=>{he=r},ke=r=>{Te=r},we=()=>{$=void 0,z=void 0},Ue=()=>he??Ke(),qe=()=>Te??Ge();var Re=()=>{let r=Ue();return r?r.getStore()??{}:{}};var Je=()=>{let r=qe();return r?r.getStore()??[]:[]},Le=r=>{let e=Je();return e.length===0?r:O(e,r)};var Ve=r=>r.map(e=>({category:f(e.category),hasLevel:e.lowestLevel!==void 0,...e.sinks!==void 0&&{sinks:e.sinks},...e.parentSinks!==void 0&&{parentSinks:e.parentSinks},...e.filters!==void 0&&{filters:e.filters}})),Be=(r,e)=>{let t=e.map((l,g)=>({index:g,length:f(l.category).length})).filter(({index:l})=>B(r,f(e[l].category))).sort((l,g)=>g.length-l.length),o=new Set,n=new Set,s=-1,a=!0;for(let{index:l}of t){let g=e[l];if(s<0&&g.lowestLevel!==void 0&&(s=l),!!a){for(let u of g.sinks??[])o.add(u);for(let u of g.filters??[])n.add(u);g.sinks!==void 0&&g.sinks.length>0&&g.parentSinks==="override"&&(a=!1)}}return{levelIndex:s,sinks:[...o],filters:[...n]}},Ye=(r,e)=>{J();let t=k();if(t===null)return null;let o;try{o=t.call("logResolveConfig",{category:r,loggers:Ve(e)})}catch{return null}return o.error!==void 0&&o.error!==""||o.levelIndex===void 0||o.sinks===void 0||o.filters===void 0?null:{levelIndex:o.levelIndex,sinks:o.sinks,filters:o.filters}},Ae=(r,e)=>e.length===0?{levelIndex:-1,sinks:[],filters:[]}:Ye(r,e)??Be(r,e);var Fe=null,X=r=>{Fe=r},Ee=null,Z=r=>{Ee=r},c=null,p=new Map,Xe=()=>c,Ze=()=>c!==null,er=async r=>{(r.reset||c===null)&&await Pe(),c={sinks:new Map(Object.entries(r.sinks)),filters:new Map(Object.entries(r.filters??{})),loggers:new Map,contextLocalStorage:r.contextLocalStorage};for(let e of r.loggers){let t=f(e.category),o=S(t);c.loggers.set(o,{...e,category:t})}r.contextLocalStorage&&Q(r.contextLocalStorage),p.clear(),await Ee?.(r.loggers)},Pe=async()=>{if(c)for(let r of c.sinks.values()){let e=r;typeof e.dispose=="function"?await e.dispose():typeof e[Symbol.asyncDispose]=="function"&&await e[Symbol.asyncDispose]()}c=null,p.clear(),Fe?.(),Q(void 0),ke(void 0),we()},ee=r=>{let e=S(r),t=p.get(e);if(t)return t;let o={sinks:[],filters:[],lowestLevel:i.Info};if(!c)return o;let n=Array.from(c.loggers.values()),s=Ae(r,n),a=n[s.levelIndex];a?.lowestLevel!==void 0&&(o.lowestLevel=a.lowestLevel);for(let l of s.sinks){let g=c.sinks.get(l);g&&o.sinks.push(g)}for(let l of s.filters){let g=c.filters.get(l);g&&o.filters.push(g)}return p.set(e,o),o},rr=(r,e)=>{if(!c)throw new Error("Logging not configured. Call configure() first.");c.sinks.set(r,e),p.clear()},tr=r=>{c&&(c.sinks.delete(r),p.clear())},nr=(r,e)=>{if(!c)throw new Error("Logging not configured. Call configure() first.");c.filters.set(r,e),p.clear()},or=r=>{c&&(c.filters.delete(r),p.clear())},sr=r=>{if(!c)throw new Error("Logging not configured. Call configure() first.");let e=f(r.category),t=S(e);c.loggers.set(t,{...r,category:e}),p.clear()},ar=()=>c?Array.from(c.sinks.keys()):[],ir=()=>c?Array.from(c.filters.keys()):[],gr=()=>c?Array.from(c.loggers.values()).map(r=>f(r.category)):[];var j={};_(j,{DEFAULT_LEVEL:()=>yr,Logger:()=>A,clearLoggerCache:()=>Ne,current:()=>xr,getLogger:()=>mr});var lr="[circular cause]",cr=r=>{let e=new Set,t=n=>n instanceof Error?e.has(n)?lr:o(n):n,o=n=>{e.add(n);let s={name:n.name,message:n.message};for(let[l,g]of Object.entries(n))s[l]=t(g);s.stack=n.stack,n instanceof AggregateError&&(s.errors=Array.isArray(n.errors)?n.errors.map(t):n.errors);let a=n.cause;return a!==void 0&&(s.cause=t(a)),e.delete(n),s};return o(r)},Ie=(r,e)=>e instanceof Error?cr(e):e,b=r=>{try{return JSON.stringify(r,Ie)}catch{return null}};var yr=i.Info,M=r=>r<=4?"TRACE":r<=8?"DEBUG":r<=12?"INFO":r<=16?"WARN":r<=20?"ERROR":r<=24?"FATAL":"PANIC",te=r=>r instanceof Error?r.message:String(r),ie=r=>{try{console.error(r)}catch{}},ne=!1,ur=r=>{ne||(ne=!0,ie(`[eserstack/logging] Go logging backend unavailable (${r}); log records now go to a local console sink on stderr. Reported once per process.`))},fr=(r,e,t,o)=>{let n=Object.keys(o).length>0?` ${b(o)??'{"attrs":"unserializable"}'}`:"";ie(`${new Date().toISOString()} ${M(e)} ${w(r)}: ${t}${n}`)},oe=new WeakSet,re=(r,e,t)=>{oe.has(e)||(oe.add(e),ie(`[eserstack/logging] a configured log ${r} failed (${te(t)}); the records it fails on are lost. Reported once per ${r}.`))},dr=(r,e,t)=>{for(let o of t)try{if(!o(r))return}catch(n){re("filter",o,n);return}for(let o of e)try{let n=o(r);n!==void 0&&Promise.resolve(n).catch(s=>{re("sink",o,s)})}catch(n){re("sink",o,n)}},R=new Map,se=0,pr=()=>{let r=k();if(r!==null)for(let e of R.values())for(let{handle:t}of e)try{r.call("logClose",t)}catch{}R.clear(),se+=1},A=class r{category;parent;#r;#e=null;#n=-1;#o=!1;constructor(e,t=null,o={}){this.category=f(e),this.parent=t,this.#r=o}#s(){return ee(this.category)}#t(e){this.#o=!0,ur(e)}#a(){if(this.#n===se)return this.#e;this.#n=se,this.#e=null;try{let e=I(),t=S(this.category),o=M(this.#s().lowestLevel),n=R.get(t)??[],s=n.find(l=>l.level===o);if(s!==void 0)return this.#e=s.handle,this.#e;let a=e.call("logCreate",{scopeName:w(this.category),level:o});if(a.handle===void 0||a.handle==="")return this.#t(a.error??`logCreate returned ${JSON.stringify(a)}`),null;this.#e=a.handle,n.push({handle:a.handle,level:o}),R.set(t,n)}catch(e){return this.#t(te(e)),null}return this.#e}#i(e,t,o,n){let s=b({handle:e,level:M(t),message:o,attrs:n});if(s===null)return!1;try{let a=I().call("logWrite",s);if(a.error===void 0||a.error==="")return!0;this.#t(a.error)}catch(a){this.#t(te(a))}return!1}#g(e,t,o){let n=this.#o?null:this.#a();n!==null&&this.#i(n,e,t,o)||fr(this.category,e,t,o)}getChild(e){let t=O(this.category,f(e));return new r(t,this,this.#r)}with(e){return new r(this.category,this.parent,{...this.#r,...e})}get loggerName(){return w(this.category)}asString(e,t=!1){return typeof e=="string"?t?`"${e}"`:e:e===null||typeof e=="number"||typeof e=="bigint"||typeof e=="boolean"||typeof e>"u"||typeof e=="symbol"?String(e):e instanceof Error?e.stack??`${e.name}: ${e.message}`:e!==null&&typeof e=="object"?Array.isArray(e)?JSON.stringify(e):`{${Object.entries(e).map(([o,n])=>`"${o}":${this.asString(n,!0)}`).join(",")}}`:"undefined"}async log(e,t,...o){let n=this.#s();if(e<n.lowestLevel)return t instanceof Function?void 0:t;let s,a;t instanceof Function?(s=t(),a=this.asString(s)):a=this.asString(t);let l=Re()??{};if(n.sinks.length>0)return dr({message:a,rawMessage:a,args:o,datetime:new Date,severity:e,category:this.category,properties:this.#r,context:l},n.sinks,n.filters),t instanceof Function?s:t;let g={...this.#r,...l};return o.length>0&&(g.args=o),this.#g(e,a,g),t instanceof Function?s:t}debug(e,...t){return this.log(i.Debug,e,...t)}info(e,...t){return this.log(i.Info,e,...t)}warn(e,...t){return this.log(i.Warning,e,...t)}error(e,...t){return this.log(i.Error,e,...t)}critical(e,...t){return this.log(i.Critical,e,...t)}emergency(e,...t){return this.log(i.Emergency,e,...t)}alert(e,...t){return this.log(i.Alert,e,...t)}notice(e,...t){return this.log(i.Notice,e,...t)}trace(e,...t){return this.log(i.Trace,e,...t)}},ae=new Map,mr=r=>{let e=Le(f(r)),t=S(e),o=ae.get(t);return o===void 0&&(o=new A(e),ae.set(t,o)),o},Ne=()=>{ae.clear(),pr(),ne=!1,oe=new WeakSet};X(Ne);Z(r=>{let e=k();if(!(e===null||R.size===0))for(let t of r){if(t.lowestLevel===void 0)continue;let o=f(t.category),n=S(o),s=M(t.lowestLevel);for(let a of R.get(n)??[])e.call("logConfigure",{handle:a.handle,level:s}),a.level=s}});var xr=new A(["default"]);var H={};_(H,{fingersCrossedSink:()=>Lr,getBufferedSink:()=>Rr,getOutputSink:()=>kr,getRecordCollectorSink:()=>De,getTestSink:()=>br,withFilter:()=>wr});var Sr={[i.Trace]:"TRCE",[i.Debug]:"DBUG",[i.Info]:"INFO",[i.Notice]:"NOTC",[i.Warning]:"WARN",[i.Error]:"ERRO",[i.Critical]:"CRIT",[i.Alert]:"ALRT",[i.Emergency]:"EMRG"};var Cr=(r,e)=>{if(e==="none")return"";if(typeof e=="function")return e(r);let t=r.toISOString(),o=t.slice(0,10),n=t.slice(11,19),s=t.slice(19);switch(e){case"rfc3339":return t;case"date-time-timezone":case void 0:return`${o} ${n}${s}`;case"date-time":return`${o} ${n}`;case"time-timezone":return`${n}${s}`;case"time":return n;case"date":return o}},vr=r=>b(r)??String(r),hr=(r,e)=>{let t={...e,...r},o=Object.entries(t);return o.length===0?"":" "+o.map(([n,s])=>{let a=typeof s=="string"?s:vr(s);return`${n}=${a}`}).join(" ")};var Tr=(r,e)=>{switch(r){case i.Trace:return P(ue(e));case i.Debug:return fe(e);case i.Info:return ce(e);case i.Notice:return G(e);case i.Warning:return ye(e);case i.Error:return T(e);case i.Critical:return E(T(e));case i.Alert:return E(T(e));case i.Emergency:return E(T(e));default:return C(e)}},$e=r=>{let e=Cr(r.datetime,"date-time-timezone"),t=Sr[r.severity]??"????",o=r.category.length>0?w(r.category):"",n=hr(r.properties,r.context),s=[];return e&&s.push(P(e),C(" ")),s.push(Tr(r.severity,t),C(" ")),o&&s.push(G(`[${o}]`),C(" ")),r.severity>=i.Error?s.push(T(r.message)):s.push(C(r.message)),n.trim()&&s.push(C(" "),P(n.trim())),s};var kr=(r,e)=>{let t=e?.formatter??$e;return o=>{let n=t(o);r.writeln(...n)}},wr=(r,e)=>t=>{if(e(t))return r(t)},Rr=(r,e={})=>{let{maxSize:t=100,flushIntervalMs:o=5e3}=e,n=[],s=null,a=async()=>{if(n.length===0)return;let u=n;n=[],s!==null&&(clearTimeout(s),s=null),await Promise.all(u.map(y=>r(y)))},l=()=>{s===null&&(s=setTimeout(()=>{s=null,a().catch(()=>{})},o))},g=async u=>{n.push(u),n.length>=t?await a():l()};return g.flush=a,g},Lr=(r,e={})=>{let{triggerLevel:t=i.Error,maxBufferSize:o=1e3}=e,n=[],s=!1,a=async()=>{let u=n;n=[],s=!0,await Promise.all(u.map(y=>r(y)))},l=()=>{n=[],s=!1},g=async u=>{if(s){await r(u);return}if(u.severity>=t){n.push(u),await a();return}n.push(u),n.length>o&&n.shift()};return g.flush=a,g.clear=l,g},De=()=>{let r=[];return{sink:t=>{r.push(t)},records:r}},br=De;var rt=Ce.getTracer("@eserstack/logging");var ge=(r,e,t)=>{let o=r.streamText(e,t);return{name:`ai-text/${r.provider}/${r.modelId}`,readable:new ReadableStream({async start(n){try{for await(let s of o)if(s.kind==="content_delta")n.enqueue(K(s.textDelta));else if(s.kind==="error"){n.error(s.error);return}n.close()}catch(s){n.error(s)}}})}};var Ir=new Map([["cc","claude-code"],["ol","ollama"],["oc","opencode"],["oai","openai"],["ant","anthropic"],["gem","gemini"],["vtx","vertexai"],["kr","kiro"]]),Or=new Map([["claude-code","Claude Code"],["ollama","Ollama"],["opencode","OpenCode"],["kiro","Kiro"],["anthropic","Anthropic API"],["openai","OpenAI API"],["gemini","Gemini API"],["vertexai","Vertex AI"]]),Nr=r=>Ir.get(r)??r,$r=async r=>{if(r){let e=x.process.stderr.getWriter(),t=U({renderer:pe.ansi(),sink:q.writable(new WritableStream({async write(o){await e.write(new TextEncoder().encode(String(o.data)))},close(){e.releaseLock()}}))});await L.configure({sinks:{stderr:H.getOutputSink(t)},loggers:[{category:["ai"],lowestLevel:i.Debug,sinks:["stderr"]}]})}return j.getLogger(["ai","ask"])},zr=async r=>{if(await r.info("Auto-detecting AI provider..."),await V("claude"))return await r.info("Claude Code detected."),"claude-code";try{if((await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok)return await r.info("Ollama detected at localhost:11434."),"ollama"}catch{}if(await V("opencode"))return await r.info("OpenCode detected."),"opencode";if(x.capabilities.env){if(x.env.has("ANTHROPIC_API_KEY")||x.env.has("ANTHROPIC_AUTH_TOKEN"))return await r.info("Anthropic API key detected."),"anthropic";if(x.env.has("OPENAI_API_KEY"))return await r.info("OpenAI API key detected."),"openai"}throw new Error("No AI provider detected. Install claude, ollama, or set ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN / OPENAI_API_KEY.")},Dr=async r=>{let t=await(await import("./mod-XVE4ZWPY.js")).factoryFor(r);if(t===void 0)throw new Error(`Unknown provider: ${r}`);return t},je='Usage: ai ask "your prompt" [-p provider] [-m model] [--max-tokens n] [--effort level] [--json] [--verbose]',Mr=new Set(["low","medium","high","xhigh","max"]),jr=r=>Mr.has(r),Hr=new Set(["-p","--provider","-m","--model","--max-tokens","--effort"]),_r=r=>{let e=null,t=null,o=null,n=null,s=!1,a=!1,l=[],g=0;for(;g<r.length;){let y=r[g];if(Hr.has(y)){let d=r[g+1];if(d===void 0)return m(`${y} needs a value. ${je}`);switch(y){case"-p":case"--provider":e=d;break;case"-m":case"--model":t=d;break;case"--max-tokens":{let h=Number(d);if(!Number.isSafeInteger(h)||h<=0)return m(`--max-tokens ${JSON.stringify(d)} is not a positive whole number; pass the output token limit, such as --max-tokens 1024`);o=h;break}case"--effort":if(!jr(d))return m(`--effort ${JSON.stringify(d)} is not an effort level; use low, medium, high, xhigh or max`);n=d;break}g+=2;continue}if(y==="--json"){s=!0,g+=1;continue}if(y==="-v"||y==="--verbose"){a=!0,g+=1;continue}y.startsWith("-")||l.push(y),g+=1}let u=l.join(" ");return u.length===0?m(je):F({provider:e,model:t,maxTokens:o,effort:n,json:s,verbose:a,prompt:u})},St=async r=>{let e=_r(r??[]);if(W(e))return m({message:e.error,exitCode:1});let{provider:t,model:o,maxTokens:n,effort:s,json:a,verbose:l,prompt:g}=e.value,u=await $r(l);try{let y=t!==null?Nr(t):await zr(u),d=Or.get(y)??y,h=o??qr(y);await u.info(`Using ${d} (${h})`);let He=await Dr(y),le=new Se({factories:[He]});try{let _e=await le.addModel("default",{provider:y,model:h});return await u.info(`Sending prompt (${g.length} chars)...`),await Wr(_e,{messages:[me("user",g)],maxTokens:n??void 0,effort:s??void 0},a,u)}finally{await le.close()}}catch(y){let d=y instanceof Error?y.message:String(y);return await u.error(d),l&&y instanceof Error&&y.cause!==void 0&&await u.debug(`Cause: ${String(y.cause)}`),m({message:d,exitCode:1})}},Wr=async(r,e,t,o)=>{if(t){let s=await r.generateText(e);if(W(s))return await o.error(s.error.message),m({message:s.error.message,exitCode:1});let a=s.value;await o.info(`Response received (${xe(a).length} chars)`);let l=U({sink:q.stdout()});return l.writeln(JSON.stringify(a,null,2)),await l.close(),F(void 0)}await de().from(ge(r,e)).to(Ur()).run();let n=x.process.stdout.getWriter();return await n.write(new TextEncoder().encode(`
|
|
2
|
-
`)),n.releaseLock(),F(void 0)},Kr=12,Gr=r=>new Promise(e=>setTimeout(e,r)),Ur=(r=Kr)=>{let e=new TextEncoder;return{name:"typewriter",writable:new WritableStream({async write(t){let o=String(t.data),n=x.process.stdout.getWriter();try{for(let s of o)await n.write(e.encode(s)),await Gr(r)}finally{n.releaseLock()}}})}},qr=r=>{switch(r){case"claude-code":return"claude-sonnet-5";case"ollama":return"llama3";case"opencode":return"default";case"kiro":return"default";case"anthropic":return"claude-sonnet-5";case"openai":return"gpt-5.6-terra";case"gemini":return"gemini-3.6-flash";case"vertexai":return"gemini-3.6-flash";default:return"default"}};export{St as main,_r as parseAskArgs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as j}from"./chunk-7J6R2D2K.js";import{p as R,z as b}from"./chunk-5ALJRBMW.js";import"./chunk-SWRVSRYY.js";import"./chunk-FLLYK5FU.js";import{c as p,d as A}from"./chunk-W7KQFMHV.js";import{c as h,d as l,f as o,h as g,o as y,q as C,r as k}from"./chunk-BRC46A3N.js";import"./chunk-TKBGNLNV.js";import"./chunk-XGRZPTAD.js";import"./chunk-XTQFSF6C.js";import{H as v,U as E,r as x,u as S,w as $}from"./chunk-SWP6BJR6.js";import{C as w}from"./chunk-M4U4Y3XQ.js";import{a as f,b as i}from"./chunk-CL55MNGD.js";import"./chunk-HISXAZ4Y.js";var K=async m=>{let e=y({renderer:k.ansi(),sink:C.stdout()}),{root:r}=await E(),d=await A(r),a=$(m,d);if(!a.ok)return e.writeln(o(a.error)),await e.close(),i({exitCode:1});let u=(m??[]).filter(t=>!t.startsWith("--spec=")).join(" "),n=u===""?"No reason given":u,s;try{s=await S(r,a.spec,d)}catch(t){let N=t instanceof Error?t.message:String(t);return e.writeln(o(N)),await e.close(),i({exitCode:1})}if(s.spec!==null){let t=`${r}/${x.specDir(s.spec)}`;try{await w.fs.stat(t)}catch{return e.writeln(o(`Active spec '${s.spec}' directory not found.`)),e.writeln(l(`Run \`${p(`spec ${s.spec} reset`)}\` to return to idle.`)),await e.close(),i({exitCode:1})}}if(s.phase!=="EXECUTING")return e.writeln(o(`Cannot block in phase: ${s.phase}`)),await e.close(),i({exitCode:1});let D=await j(r),c=R(s,n);return c=b(c,"EXECUTING","BLOCKED",D,n),await v(r,c),e.writeln(g("\u26A0")," Spec blocked: ",l(n)),e.writeln("Resolve with: ",h(`${p(`spec ${a.spec} next --answer="resolution"`)}`)),await e.close(),f(void 0)};export{K as main};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as $}from"./chunk-6BKTY7SA.js";import{a as L,d as U}from"./chunk-HLDPASM6.js";import{h as T}from"./chunk-7J6R2D2K.js";import{N as P,r as x,z as I}from"./chunk-5ALJRBMW.js";import"./chunk-SWRVSRYY.js";import"./chunk-FLLYK5FU.js";import{c as D,d as k}from"./chunk-W7KQFMHV.js";import{d,f as i,g as u,o as f,q as w,r as h}from"./chunk-BRC46A3N.js";import"./chunk-TKBGNLNV.js";import"./chunk-XGRZPTAD.js";import"./chunk-XTQFSF6C.js";import{U as v,r as S,u as g,w as E,x as y,z as C}from"./chunk-SWP6BJR6.js";import{C as m}from"./chunk-M4U4Y3XQ.js";import{a as l,b as n}from"./chunk-CL55MNGD.js";import"./chunk-HISXAZ4Y.js";var H=async A=>{let t=f({renderer:h.ansi(),sink:w.stdout()}),{root:s}=await v(),o=await k(s),c=E(A,o);if(!c.ok)return t.writeln(i(c.error)),await t.close(),n({exitCode:1});let e;try{e=await g(s,c.spec,o)}catch(a){let R=a instanceof Error?a.message:String(a);return t.writeln(i(R)),await t.close(),n({exitCode:1})}if(e.phase==="IDLE"||e.phase==="UNINITIALIZED"||e.phase==="COMPLETED")return t.writeln(i(`Cannot cancel in phase: ${e.phase}`)),await t.close(),n({exitCode:1});if(e.spec!==null){let a=`${s}/${S.specDir(e.spec)}`;try{await m.fs.stat(a)}catch{return t.writeln(i(`Active spec '${e.spec}' directory not found.`)),t.writeln(d(`Run \`${D(`spec ${e.spec} reset`)}\` to return to idle.`)),await t.close(),n({exitCode:1})}}let p=await T(s),r=x(e,"cancelled");r=I(r,e.phase,"COMPLETED",p,"cancelled"),r.spec!==null&&await C(s,r.spec,r);let O=P(r);return await y(s,O),r.spec!==null&&(await L(s,r.spec,"cancelled"),await U(s,r.spec,"cancelled")),await $(s,{ts:new Date().toISOString(),type:"phase-change",spec:e.spec??"unknown",user:p.name,from:e.phase,to:"COMPLETED",reason:"cancelled"}),t.writeln(u("\u2714")," Spec cancelled."),await t.close(),l(void 0)};export{H as main};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as w,h as y,r as S}from"./chunk-5ALJRBMW.js";import{b as d,r as m,z as h}from"./chunk-SWP6BJR6.js";import{C as p}from"./chunk-M4U4Y3XQ.js";var f=t=>{let e=w(d(),t.name,`spec/${t.name}`,t.description??void 0);return y({...e,discovery:{...e.discovery,answers:[...t.answers]}})},n=class extends Error{names;constructor(e,a){super(e),this.names=a,this.name="SplitRefusedError"}},g=async(t,e)=>await p.fs.exists(`${t}/${m.specDir(e)}`),x=async(t,e)=>{if(await g(t,e.name))throw new n(`Cannot create spec "${e.name}": a spec with that name already exists.`,[e.name]);await p.fs.mkdir(`${t}/${m.specDir(e.name)}`,{recursive:!0}),await h(t,e.name,f(e))},D=async(t,e,a,u)=>{let i=a.map(s=>s.name),l=s=>[...new Set(s)].map(c=>`"${c}"`).join(", "),r=i.filter((s,c)=>i.indexOf(s)!==c);if(r.length>0)throw new n(`Cannot split: child spec names must be unique, and these repeat: ${l(r)}.`,[...new Set(r)]);let o=(await Promise.all(i.map(async s=>await g(t,s)?s:null))).filter(s=>s!==null);if(o.length>0)throw new n(`Cannot split: these specs already exist: ${l(o)}. Choose other names with \`${u} spec ${e.spec??"<name>"} split --into <first> "<description>" --into <second> "<description>"\`.`,o);return await Promise.all(a.map(s=>x(t,s))),S(e,"cancelled",`Split into: ${i.join(", ")}`)};export{n as a,D as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as i,f as c,g as m,h as p}from"./chunk-HNQA5O2S.js";import{a as g,k as d}from"./chunk-YN3SHWBR.js";import{a,b as l}from"./chunk-CL55MNGD.js";var s=class{capabilities=["text_generation","streaming","tool_calling","vision","audio","structured_output","reasoning"];provider="gemini";modelId;client;config;constructor(o,r){this.client=o,this.config=r,this.modelId=r.model}async generateText(o,r){try{let t=i(this.config,o,this.provider,r),n=await this.client.models.generateContent({model:this.config.model,...t});return a(c(n,this.modelId))}catch(t){return l(y(t))}}async*streamText(o,r){try{let t=i(this.config,o,this.provider,r),n=await this.client.models.generateContentStream({model:this.config.model,...t});yield*m(n)}catch(t){yield{kind:"error",error:y(t)}}}async close(){}getRawClient(){return this.client}},v={provider:"gemini",createModel:async e=>{let o=await import("./node-XYP2DQHR.js"),r=new o.GoogleGenAI({apiKey:e.apiKey,apiVersion:"v1beta"});return new s(r,e)}},y=e=>{if(e instanceof g)return e;let o=e instanceof Error?e:new Error(String(e)),r=p(e);return d("gemini",r,o)};export{s as a,v as b};
|