@gobing-ai/ts-ai-runner 0.4.46 → 0.4.47
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/dist/agents/shims.d.ts +2 -0
- package/dist/agents/shims.d.ts.map +1 -1
- package/dist/agents/shims.js +11 -4
- package/dist/ai-runner.d.ts.map +1 -1
- package/dist/ai-runner.js +5 -2
- package/package.json +4 -4
- package/src/agents/shims.ts +12 -4
- package/src/ai-runner.ts +11 -4
package/dist/agents/shims.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface PromptOptions {
|
|
|
32
32
|
model?: string;
|
|
33
33
|
/** Output mode passed through to the agent CLI. */
|
|
34
34
|
mode?: OutputMode;
|
|
35
|
+
/** Process timeout mirrored into CLIs that impose a shorter internal wait. */
|
|
36
|
+
timeoutMs?: number;
|
|
35
37
|
/** Team-mode purpose included in the identity preamble. */
|
|
36
38
|
purpose?: string;
|
|
37
39
|
/** Caller-defined prompt tags. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shims.d.ts","sourceRoot":"","sources":["../../src/agents/shims.ts"],"names":[],"mappings":"AAEA,gEAAgE;AAChE,MAAM,MAAM,SAAS,GACf,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,IAAI,GACJ,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,CAAC;AAEb,0CAA0C;AAC1C,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,mEAAmE;AACnE,MAAM,WAAW,WAAW;IACxB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC1B,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAA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kB,EAAE,OAAO,CAAC;CACxC;AA2BD,6EAA6E;AAC7E,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,GAAG,sBAAsB,CAElF;AAED,mEAAmE;AACnE,eAAO,MAAM,cAAc,EAAE,SAAS,SAAS,EAS9C,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,aAAa,EAAE,SAAS,SAAS,EAW7C,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,SAAS,CAAyB,CAAC;AAU1E;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAQrE;AAED;mEACmE;AACnE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAMxD"}
|
package/dist/agents/shims.js
CHANGED
|
@@ -6,7 +6,9 @@ const claudeShim = {
|
|
|
6
6
|
getHelpCommand: () => ({ command: 'claude', args: ['--help'] }),
|
|
7
7
|
getVersionCommand: () => ({ command: 'claude', args: ['--version'] }),
|
|
8
8
|
getPromptCommand: (options) => {
|
|
9
|
-
|
|
9
|
+
// Headless dispatch cannot answer edit approval prompts. acceptEdits
|
|
10
|
+
// grants only file edits, leaving shell and broader tools gated.
|
|
11
|
+
const args = ['-p', options.input ?? '', '--permission-mode', 'acceptEdits'];
|
|
10
12
|
const hasSession = options.sessionId !== undefined || options.sessionDir !== undefined;
|
|
11
13
|
if (hasSession) {
|
|
12
14
|
// Session/pin path — never emit --continue. Claude has no session-dir
|
|
@@ -129,9 +131,11 @@ const antigravityCliShim = {
|
|
|
129
131
|
// it auto-approves edit permission requests only, not all tools. Trust
|
|
130
132
|
// assumption: the dispatch is already an operator-initiated, headless,
|
|
131
133
|
// workspace-scoped subprocess running agent-emitted commands under the
|
|
132
|
-
// caller's supervision. This is the only
|
|
133
|
-
//
|
|
134
|
+
// caller's supervision. This is the narrow edit-only policy shared by
|
|
135
|
+
// configured headless executors that otherwise prompt (spur 0689).
|
|
134
136
|
const args = ['-p', options.input ?? '', '--mode', 'accept-edits'];
|
|
137
|
+
if (options.timeoutMs !== undefined)
|
|
138
|
+
args.push('--print-timeout', `${options.timeoutMs}ms`);
|
|
135
139
|
// Headless agy resolves relative file-tool paths against a scratch dir,
|
|
136
140
|
// not the process cwd; --add-dir re-roots them into the real workspace
|
|
137
141
|
// (spur 0689, verified: without it expectFile artifacts land in scratch).
|
|
@@ -225,7 +229,10 @@ const grokShim = {
|
|
|
225
229
|
getHelpCommand: () => ({ command: 'grok', args: ['--help'] }),
|
|
226
230
|
getVersionCommand: () => ({ command: 'grok', args: ['--version'] }),
|
|
227
231
|
getPromptCommand: (options) => {
|
|
228
|
-
|
|
232
|
+
// Grok 1.0.5 accepts --permission-mode acceptEdits but still narrates
|
|
233
|
+
// writes without invoking the tool in single-turn mode. Tool-scoped
|
|
234
|
+
// allow rules are the narrow verified noninteractive affordance.
|
|
235
|
+
const args = ['-p', options.input ?? '', '--allow', 'Write', '--allow', 'Edit'];
|
|
229
236
|
const hasSession = options.sessionId !== undefined || options.sessionDir !== undefined;
|
|
230
237
|
if (hasSession) {
|
|
231
238
|
// Session/pin path — never emit -c. grok has no session-dir flag;
|
package/dist/ai-runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-runner.d.ts","sourceRoot":"","sources":["../src/ai-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,QAAQ,EAAa,KAAK,MAAM,EAAc,MAAM,qBAAqB,CAAC;AAC5G,OAAO,EAGH,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAgB,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,g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IAgCzC,iCAAiC;IACjC,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAIxF,oCAAoC;IACpC,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAI3F,mCAAmC;IACnC,gBAAgB,CACZ,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,OAAO,GAAE,eAAoB,GAC9B,OAAO,CAAC,cAAc,CAAC;IAI1B,6EAA6E;IAC7E,eAAe,CACX,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,aAAa,EAC5B,OAAO,GAAE,eAAoB,GAC9B,OAAO,CAAC,cAAc,CAAC;IAI1B,0DAA0D;IAC1D,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,GAAE,eAAoB,GAAG,WAAW;IAa9G,4EAA4E;IAC5E,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;YAKjF,MAAM;CAsDvB;AAWD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAC/B,WAAW,CAKb"}
|
package/dist/ai-runner.js
CHANGED
|
@@ -101,7 +101,10 @@ export class AiRunner {
|
|
|
101
101
|
}
|
|
102
102
|
/** Build an agent prompt command without executing it. */
|
|
103
103
|
buildPromptCommand(agent, promptOptions, options = {}) {
|
|
104
|
-
return buildAgentCommand(agent,
|
|
104
|
+
return buildAgentCommand(agent, {
|
|
105
|
+
...promptOptions,
|
|
106
|
+
timeoutMs: options.timeout ?? promptOptions.timeoutMs ?? this.defaultTimeout,
|
|
107
|
+
}, {
|
|
105
108
|
workspace: options.cwd ?? this.defaultCwd ?? getProcessCwd(),
|
|
106
109
|
});
|
|
107
110
|
}
|
|
@@ -173,8 +176,8 @@ function hasIdentityOptions(options) {
|
|
|
173
176
|
*/
|
|
174
177
|
export function buildAgentCommand(agent, promptOptions, context) {
|
|
175
178
|
return getAgentShim(agent).getPromptCommand({
|
|
176
|
-
workspace: context.workspace,
|
|
177
179
|
...applyIdentityPreamble(agent, promptOptions, context),
|
|
180
|
+
workspace: context.workspace,
|
|
178
181
|
});
|
|
179
182
|
}
|
|
180
183
|
function applyIdentityPreamble(agent, promptOptions, context) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-ai-runner",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.47",
|
|
4
4
|
"description": "@gobing-ai/ts-ai-runner — Coding-agent shims, detection, doctor checks, and prompt execution.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-ai-runner-v<version> && git push --tags' && exit 1"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@gobing-ai/ts-infra": "^0.4.
|
|
51
|
-
"@gobing-ai/ts-runtime": "^0.4.
|
|
50
|
+
"@gobing-ai/ts-infra": "^0.4.47",
|
|
51
|
+
"@gobing-ai/ts-runtime": "^0.4.47"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/bun": "1.3.14",
|
|
55
|
-
"@gobing-ai/ts-db": "^0.4.
|
|
55
|
+
"@gobing-ai/ts-db": "^0.4.47"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
package/src/agents/shims.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface PromptOptions {
|
|
|
47
47
|
model?: string;
|
|
48
48
|
/** Output mode passed through to the agent CLI. */
|
|
49
49
|
mode?: OutputMode;
|
|
50
|
+
/** Process timeout mirrored into CLIs that impose a shorter internal wait. */
|
|
51
|
+
timeoutMs?: number;
|
|
50
52
|
/** Team-mode purpose included in the identity preamble. */
|
|
51
53
|
purpose?: string;
|
|
52
54
|
/** Caller-defined prompt tags. */
|
|
@@ -102,7 +104,9 @@ const claudeShim: AgentShim = {
|
|
|
102
104
|
getHelpCommand: () => ({ command: 'claude', args: ['--help'] }),
|
|
103
105
|
getVersionCommand: () => ({ command: 'claude', args: ['--version'] }),
|
|
104
106
|
getPromptCommand: (options) => {
|
|
105
|
-
|
|
107
|
+
// Headless dispatch cannot answer edit approval prompts. acceptEdits
|
|
108
|
+
// grants only file edits, leaving shell and broader tools gated.
|
|
109
|
+
const args = ['-p', options.input ?? '', '--permission-mode', 'acceptEdits'];
|
|
106
110
|
const hasSession = options.sessionId !== undefined || options.sessionDir !== undefined;
|
|
107
111
|
if (hasSession) {
|
|
108
112
|
// Session/pin path — never emit --continue. Claude has no session-dir
|
|
@@ -216,9 +220,10 @@ const antigravityCliShim: AgentShim = {
|
|
|
216
220
|
// it auto-approves edit permission requests only, not all tools. Trust
|
|
217
221
|
// assumption: the dispatch is already an operator-initiated, headless,
|
|
218
222
|
// workspace-scoped subprocess running agent-emitted commands under the
|
|
219
|
-
// caller's supervision. This is the only
|
|
220
|
-
//
|
|
223
|
+
// caller's supervision. This is the narrow edit-only policy shared by
|
|
224
|
+
// configured headless executors that otherwise prompt (spur 0689).
|
|
221
225
|
const args = ['-p', options.input ?? '', '--mode', 'accept-edits'];
|
|
226
|
+
if (options.timeoutMs !== undefined) args.push('--print-timeout', `${options.timeoutMs}ms`);
|
|
222
227
|
// Headless agy resolves relative file-tool paths against a scratch dir,
|
|
223
228
|
// not the process cwd; --add-dir re-roots them into the real workspace
|
|
224
229
|
// (spur 0689, verified: without it expectFile artifacts land in scratch).
|
|
@@ -305,7 +310,10 @@ const grokShim: AgentShim = {
|
|
|
305
310
|
getHelpCommand: () => ({ command: 'grok', args: ['--help'] }),
|
|
306
311
|
getVersionCommand: () => ({ command: 'grok', args: ['--version'] }),
|
|
307
312
|
getPromptCommand: (options) => {
|
|
308
|
-
|
|
313
|
+
// Grok 1.0.5 accepts --permission-mode acceptEdits but still narrates
|
|
314
|
+
// writes without invoking the tool in single-turn mode. Tool-scoped
|
|
315
|
+
// allow rules are the narrow verified noninteractive affordance.
|
|
316
|
+
const args = ['-p', options.input ?? '', '--allow', 'Write', '--allow', 'Edit'];
|
|
309
317
|
const hasSession = options.sessionId !== undefined || options.sessionDir !== undefined;
|
|
310
318
|
if (hasSession) {
|
|
311
319
|
// Session/pin path — never emit -c. grok has no session-dir flag;
|
package/src/ai-runner.ts
CHANGED
|
@@ -187,9 +187,16 @@ export class AiRunner {
|
|
|
187
187
|
|
|
188
188
|
/** Build an agent prompt command without executing it. */
|
|
189
189
|
buildPromptCommand(agent: AgentName, promptOptions: PromptOptions, options: AgentRunOptions = {}): ShimCommand {
|
|
190
|
-
return buildAgentCommand(
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
return buildAgentCommand(
|
|
191
|
+
agent,
|
|
192
|
+
{
|
|
193
|
+
...promptOptions,
|
|
194
|
+
timeoutMs: options.timeout ?? promptOptions.timeoutMs ?? this.defaultTimeout,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
workspace: options.cwd ?? this.defaultCwd ?? getProcessCwd(),
|
|
198
|
+
},
|
|
199
|
+
);
|
|
193
200
|
}
|
|
194
201
|
|
|
195
202
|
/** Run an agent authentication command, or return null when unsupported. */
|
|
@@ -275,8 +282,8 @@ export function buildAgentCommand(
|
|
|
275
282
|
context: { workspace: string },
|
|
276
283
|
): ShimCommand {
|
|
277
284
|
return getAgentShim(agent).getPromptCommand({
|
|
278
|
-
workspace: context.workspace,
|
|
279
285
|
...applyIdentityPreamble(agent, promptOptions, context),
|
|
286
|
+
workspace: context.workspace,
|
|
280
287
|
});
|
|
281
288
|
}
|
|
282
289
|
|