@shipers-dev/multi 0.6.1 → 0.6.3
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/index.js +25 -3
- package/package.json +1 -1
- package/src/acpx-runner.ts +24 -2
- package/src/index.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -5382,12 +5382,12 @@ function extractText(content) {
|
|
|
5382
5382
|
|
|
5383
5383
|
// src/acpx-runner.ts
|
|
5384
5384
|
async function runAcpx(opts) {
|
|
5385
|
-
const args = ["acpx", "--format", "json", "--json-strict", "--approve-all"];
|
|
5385
|
+
const args = ["acpx", "--format", "json", "--json-strict", "--approve-all", "--ttl", "0"];
|
|
5386
5386
|
if (opts.cwd)
|
|
5387
5387
|
args.push("--cwd", opts.cwd);
|
|
5388
5388
|
args.push(opts.agentType);
|
|
5389
5389
|
if (opts.sessionName) {
|
|
5390
|
-
const ensureArgs = ["acpx", ...opts.cwd ? ["--cwd", opts.cwd] : [], opts.agentType, "sessions", "ensure", "--name", opts.sessionName];
|
|
5390
|
+
const ensureArgs = ["acpx", "--ttl", "0", ...opts.cwd ? ["--cwd", opts.cwd] : [], opts.agentType, "sessions", "ensure", "--name", opts.sessionName];
|
|
5391
5391
|
try {
|
|
5392
5392
|
const ensure = Bun.spawn(ensureArgs, { stdout: "pipe", stderr: "pipe", stdin: "ignore" });
|
|
5393
5393
|
await ensure.exited;
|
|
@@ -5399,6 +5399,27 @@ async function runAcpx(opts) {
|
|
|
5399
5399
|
args.push(opts.prompt);
|
|
5400
5400
|
const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe", stdin: "ignore" });
|
|
5401
5401
|
let stopReason = "end_turn";
|
|
5402
|
+
(async () => {
|
|
5403
|
+
try {
|
|
5404
|
+
const r = proc.stderr.getReader();
|
|
5405
|
+
const d = new TextDecoder;
|
|
5406
|
+
let sb = "";
|
|
5407
|
+
while (true) {
|
|
5408
|
+
const { value, done } = await r.read();
|
|
5409
|
+
if (done)
|
|
5410
|
+
break;
|
|
5411
|
+
sb += d.decode(value, { stream: true });
|
|
5412
|
+
let nl;
|
|
5413
|
+
while ((nl = sb.indexOf(`
|
|
5414
|
+
`)) !== -1) {
|
|
5415
|
+
const ln = sb.slice(0, nl).trim();
|
|
5416
|
+
sb = sb.slice(nl + 1);
|
|
5417
|
+
if (ln)
|
|
5418
|
+
await opts.onEvent({ event_type: "progress", payload: { message: `[acpx] ${ln.slice(0, 500)}` } });
|
|
5419
|
+
}
|
|
5420
|
+
}
|
|
5421
|
+
} catch {}
|
|
5422
|
+
})();
|
|
5402
5423
|
const reader = proc.stdout.getReader();
|
|
5403
5424
|
const dec = new TextDecoder;
|
|
5404
5425
|
let buf = "";
|
|
@@ -5460,6 +5481,7 @@ function handleSessionUpdate(params) {
|
|
|
5460
5481
|
const u = params.update || {};
|
|
5461
5482
|
const kind = u.sessionUpdate;
|
|
5462
5483
|
const out = [];
|
|
5484
|
+
out.push({ event_type: "progress", payload: { message: `[acpx upd] ${kind} keys=${Object.keys(u).join(",")}` } });
|
|
5463
5485
|
switch (kind) {
|
|
5464
5486
|
case "agent_message_chunk":
|
|
5465
5487
|
case "agent_thought_chunk": {
|
|
@@ -5531,7 +5553,7 @@ var LOG_PATH = join(MULTI_DIR, "logs", "agent.log");
|
|
|
5531
5553
|
var SKILLS_DIR = join(MULTI_DIR, "skills");
|
|
5532
5554
|
var STOP_PATH = join(MULTI_DIR, "stop.flag");
|
|
5533
5555
|
var TASKS_DB_PATH = join(MULTI_DIR, "tasks.db");
|
|
5534
|
-
var VERSION = "0.6.
|
|
5556
|
+
var VERSION = "0.6.3";
|
|
5535
5557
|
var COMMANDS = {
|
|
5536
5558
|
setup: "Register this device with a workspace",
|
|
5537
5559
|
connect: "Connect device to realtime hub and execute assigned tasks",
|
package/package.json
CHANGED
package/src/acpx-runner.ts
CHANGED
|
@@ -16,13 +16,13 @@ export interface AcpxRunOpts {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export async function runAcpx(opts: AcpxRunOpts): Promise<{ stopReason: string }> {
|
|
19
|
-
const args = ['acpx', '--format', 'json', '--json-strict', '--approve-all'];
|
|
19
|
+
const args = ['acpx', '--format', 'json', '--json-strict', '--approve-all', '--ttl', '0'];
|
|
20
20
|
if (opts.cwd) args.push('--cwd', opts.cwd);
|
|
21
21
|
args.push(opts.agentType);
|
|
22
22
|
// Ensure a session exists for this name (idempotent). ensure = get-or-create.
|
|
23
23
|
// We run it as a separate invocation, then prompt.
|
|
24
24
|
if (opts.sessionName) {
|
|
25
|
-
const ensureArgs = ['acpx', ...(opts.cwd ? ['--cwd', opts.cwd] : []), opts.agentType, 'sessions', 'ensure', '--name', opts.sessionName];
|
|
25
|
+
const ensureArgs = ['acpx', '--ttl', '0', ...(opts.cwd ? ['--cwd', opts.cwd] : []), opts.agentType, 'sessions', 'ensure', '--name', opts.sessionName];
|
|
26
26
|
try {
|
|
27
27
|
const ensure = Bun.spawn(ensureArgs, { stdout: 'pipe', stderr: 'pipe', stdin: 'ignore' });
|
|
28
28
|
await ensure.exited;
|
|
@@ -36,6 +36,26 @@ export async function runAcpx(opts: AcpxRunOpts): Promise<{ stopReason: string }
|
|
|
36
36
|
const proc = Bun.spawn(args, { stdout: 'pipe', stderr: 'pipe', stdin: 'ignore' });
|
|
37
37
|
let stopReason = 'end_turn';
|
|
38
38
|
|
|
39
|
+
// Forward stderr to our progress stream so we can debug in the UI/logs
|
|
40
|
+
(async () => {
|
|
41
|
+
try {
|
|
42
|
+
const r = (proc.stderr as ReadableStream<Uint8Array>).getReader();
|
|
43
|
+
const d = new TextDecoder();
|
|
44
|
+
let sb = '';
|
|
45
|
+
while (true) {
|
|
46
|
+
const { value, done } = await r.read();
|
|
47
|
+
if (done) break;
|
|
48
|
+
sb += d.decode(value, { stream: true });
|
|
49
|
+
let nl: number;
|
|
50
|
+
while ((nl = sb.indexOf('\n')) !== -1) {
|
|
51
|
+
const ln = sb.slice(0, nl).trim();
|
|
52
|
+
sb = sb.slice(nl + 1);
|
|
53
|
+
if (ln) await opts.onEvent({ event_type: 'progress', payload: { message: `[acpx] ${ln.slice(0, 500)}` } });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} catch {}
|
|
57
|
+
})();
|
|
58
|
+
|
|
39
59
|
const reader = (proc.stdout as ReadableStream<Uint8Array>).getReader();
|
|
40
60
|
const dec = new TextDecoder();
|
|
41
61
|
let buf = '';
|
|
@@ -92,6 +112,8 @@ function handleSessionUpdate(params: any): AcpEvent[] {
|
|
|
92
112
|
const u = params.update || {};
|
|
93
113
|
const kind = u.sessionUpdate;
|
|
94
114
|
const out: AcpEvent[] = [];
|
|
115
|
+
// Fallthrough debug: emit the update kind + keys so we can see what acpx is sending
|
|
116
|
+
out.push({ event_type: 'progress', payload: { message: `[acpx upd] ${kind} keys=${Object.keys(u).join(',')}` } });
|
|
95
117
|
switch (kind) {
|
|
96
118
|
case 'agent_message_chunk':
|
|
97
119
|
case 'agent_thought_chunk': {
|
package/src/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ const LOG_PATH = join(MULTI_DIR, 'logs', 'agent.log');
|
|
|
17
17
|
const SKILLS_DIR = join(MULTI_DIR, 'skills');
|
|
18
18
|
const STOP_PATH = join(MULTI_DIR, 'stop.flag');
|
|
19
19
|
const TASKS_DB_PATH = join(MULTI_DIR, 'tasks.db');
|
|
20
|
-
const VERSION = '0.6.
|
|
20
|
+
const VERSION = '0.6.3';
|
|
21
21
|
|
|
22
22
|
const COMMANDS = {
|
|
23
23
|
setup: 'Register this device with a workspace',
|