@aspectlylabs/mikka 0.0.3 → 0.0.4
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/cli.js +33 -7
- package/client.js +2 -2
- package/http-link.js +24 -6
- package/login.js +2 -2
- package/main.js +11 -3
- package/mikka.js +33 -7
- package/package.json +2 -2
- package/paths.js +2 -2
package/cli.js
CHANGED
|
@@ -4281,7 +4281,7 @@ import { join as join3 } from "node:path";
|
|
|
4281
4281
|
// package.json
|
|
4282
4282
|
var package_default = {
|
|
4283
4283
|
name: "@mikka/daemon",
|
|
4284
|
-
version: "0.0.
|
|
4284
|
+
version: "0.0.4",
|
|
4285
4285
|
description: "Local Mikka daemon: runs agents through the user's own CLIs",
|
|
4286
4286
|
type: "module",
|
|
4287
4287
|
private: true,
|
|
@@ -4339,7 +4339,7 @@ var package_default = {
|
|
|
4339
4339
|
engines: {
|
|
4340
4340
|
node: ">=24"
|
|
4341
4341
|
},
|
|
4342
|
-
gitHead: "
|
|
4342
|
+
gitHead: "4c5f80747928d60ea3e03ed6a3de5ca2dc2216df"
|
|
4343
4343
|
};
|
|
4344
4344
|
|
|
4345
4345
|
// src/paths.ts
|
|
@@ -4978,12 +4978,28 @@ var HttpServerLink = class {
|
|
|
4978
4978
|
const liveness = new AbortController();
|
|
4979
4979
|
const gate = new ToolApprovalGate(assignment.runId, {
|
|
4980
4980
|
permission: (request) => toolApprovalDecision(request, assignment.policy, worktree),
|
|
4981
|
+
// Keep the callback pending at the tool boundary. The adapter's current
|
|
4982
|
+
// session and checkpoint remain intact; handback resolves this same call.
|
|
4981
4983
|
isLive: async () => {
|
|
4982
4984
|
try {
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4985
|
+
for (; ; ) {
|
|
4986
|
+
check();
|
|
4987
|
+
const current = await this.call("POST", path, { body: { operation: "check", deviceId: assignment.deviceId, policyRevision }, schema: z25.object({ live: z25.boolean(), paused: z25.boolean().optional() }), signal: liveness.signal, timeoutMs: 5e3 });
|
|
4988
|
+
check();
|
|
4989
|
+
if (!current.live || !current.paused) return current.live;
|
|
4990
|
+
await new Promise((resolve10, reject) => {
|
|
4991
|
+
const stop = () => {
|
|
4992
|
+
clearTimeout(timer);
|
|
4993
|
+
reject(new Error("cancelled"));
|
|
4994
|
+
};
|
|
4995
|
+
const timer = setTimeout(() => {
|
|
4996
|
+
liveness.signal.removeEventListener("abort", stop);
|
|
4997
|
+
resolve10();
|
|
4998
|
+
}, 1e3);
|
|
4999
|
+
liveness.signal.addEventListener("abort", stop, { once: true });
|
|
5000
|
+
if (liveness.signal.aborted) stop();
|
|
5001
|
+
});
|
|
5002
|
+
}
|
|
4987
5003
|
} catch {
|
|
4988
5004
|
return false;
|
|
4989
5005
|
}
|
|
@@ -5012,9 +5028,11 @@ var HttpServerLink = class {
|
|
|
5012
5028
|
}
|
|
5013
5029
|
}
|
|
5014
5030
|
};
|
|
5031
|
+
if (!await gate.checkLive()) return "deny";
|
|
5015
5032
|
const created = await retry(() => this.call("POST", path, { body: { operation: "propose", deviceId: assignment.deviceId, policyRevision, requestId: request.requestId, harness: request.harness, method: request.method, input: request.input }, schema: proposal, signal: signal2 }));
|
|
5016
5033
|
try {
|
|
5017
5034
|
for (; ; ) {
|
|
5035
|
+
if (!await gate.checkLive()) return "deny";
|
|
5018
5036
|
const result = await retry(() => this.call("POST", path, { body: { operation: "take", deviceId: assignment.deviceId, id: created.id, digest: created.digest }, schema: response, signal: signal2 }));
|
|
5019
5037
|
if (result.decision !== "pending") return result.decision;
|
|
5020
5038
|
await delay3();
|
|
@@ -12338,7 +12356,7 @@ var RunSupervisor = class {
|
|
|
12338
12356
|
const current = this.deps.journal.get(runId);
|
|
12339
12357
|
assertMailboxRunAuthority({ held: this.active.get(runId) === run2, state: current?.state, stopped: this.stopping || run2.cancelRequested || run2.abort.signal.aborted, lease });
|
|
12340
12358
|
};
|
|
12341
|
-
|
|
12359
|
+
let mailbox = await this.deps.prepareRunMailbox?.(assignment, run2.abort.signal, checkMailbox);
|
|
12342
12360
|
run2.mailbox = mailbox;
|
|
12343
12361
|
if (this.stopping) return;
|
|
12344
12362
|
if (run2.cancelRequested) {
|
|
@@ -12348,6 +12366,14 @@ var RunSupervisor = class {
|
|
|
12348
12366
|
if (mailbox) checkMailbox();
|
|
12349
12367
|
const toolApproval = await this.deps.prepareRunToolApproval?.(assignment, run2.abort.signal, checkMailbox, worktree);
|
|
12350
12368
|
run2.toolApproval = toolApproval;
|
|
12369
|
+
if (mailbox && toolApproval) {
|
|
12370
|
+
const original = mailbox;
|
|
12371
|
+
mailbox = { tools: original.tools, close: () => original.close(), request: async (body, signal) => {
|
|
12372
|
+
if (!await toolApproval.checkLive()) throw new Error("Run tool approval unavailable");
|
|
12373
|
+
return original.request(body, signal);
|
|
12374
|
+
} };
|
|
12375
|
+
run2.mailbox = mailbox;
|
|
12376
|
+
}
|
|
12351
12377
|
if (this.stopping) {
|
|
12352
12378
|
toolApproval?.revoke();
|
|
12353
12379
|
return;
|
package/client.js
CHANGED
|
@@ -3621,7 +3621,7 @@ import { join } from "node:path";
|
|
|
3621
3621
|
// package.json
|
|
3622
3622
|
var package_default = {
|
|
3623
3623
|
name: "@mikka/daemon",
|
|
3624
|
-
version: "0.0.
|
|
3624
|
+
version: "0.0.4",
|
|
3625
3625
|
description: "Local Mikka daemon: runs agents through the user's own CLIs",
|
|
3626
3626
|
type: "module",
|
|
3627
3627
|
private: true,
|
|
@@ -3679,7 +3679,7 @@ var package_default = {
|
|
|
3679
3679
|
engines: {
|
|
3680
3680
|
node: ">=24"
|
|
3681
3681
|
},
|
|
3682
|
-
gitHead: "
|
|
3682
|
+
gitHead: "4c5f80747928d60ea3e03ed6a3de5ca2dc2216df"
|
|
3683
3683
|
};
|
|
3684
3684
|
|
|
3685
3685
|
// src/paths.ts
|
package/http-link.js
CHANGED
|
@@ -3921,7 +3921,7 @@ var InvalidIdError = class extends DaemonError {
|
|
|
3921
3921
|
// package.json
|
|
3922
3922
|
var package_default = {
|
|
3923
3923
|
name: "@mikka/daemon",
|
|
3924
|
-
version: "0.0.
|
|
3924
|
+
version: "0.0.4",
|
|
3925
3925
|
description: "Local Mikka daemon: runs agents through the user's own CLIs",
|
|
3926
3926
|
type: "module",
|
|
3927
3927
|
private: true,
|
|
@@ -3979,7 +3979,7 @@ var package_default = {
|
|
|
3979
3979
|
engines: {
|
|
3980
3980
|
node: ">=24"
|
|
3981
3981
|
},
|
|
3982
|
-
gitHead: "
|
|
3982
|
+
gitHead: "4c5f80747928d60ea3e03ed6a3de5ca2dc2216df"
|
|
3983
3983
|
};
|
|
3984
3984
|
|
|
3985
3985
|
// src/paths.ts
|
|
@@ -4176,12 +4176,28 @@ var HttpServerLink = class {
|
|
|
4176
4176
|
const liveness = new AbortController();
|
|
4177
4177
|
const gate = new ToolApprovalGate(assignment.runId, {
|
|
4178
4178
|
permission: (request) => toolApprovalDecision(request, assignment.policy, worktree),
|
|
4179
|
+
// Keep the callback pending at the tool boundary. The adapter's current
|
|
4180
|
+
// session and checkpoint remain intact; handback resolves this same call.
|
|
4179
4181
|
isLive: async () => {
|
|
4180
4182
|
try {
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4183
|
+
for (; ; ) {
|
|
4184
|
+
check();
|
|
4185
|
+
const current = await this.call("POST", path, { body: { operation: "check", deviceId: assignment.deviceId, policyRevision }, schema: z25.object({ live: z25.boolean(), paused: z25.boolean().optional() }), signal: liveness.signal, timeoutMs: 5e3 });
|
|
4186
|
+
check();
|
|
4187
|
+
if (!current.live || !current.paused) return current.live;
|
|
4188
|
+
await new Promise((resolve2, reject) => {
|
|
4189
|
+
const stop = () => {
|
|
4190
|
+
clearTimeout(timer);
|
|
4191
|
+
reject(new Error("cancelled"));
|
|
4192
|
+
};
|
|
4193
|
+
const timer = setTimeout(() => {
|
|
4194
|
+
liveness.signal.removeEventListener("abort", stop);
|
|
4195
|
+
resolve2();
|
|
4196
|
+
}, 1e3);
|
|
4197
|
+
liveness.signal.addEventListener("abort", stop, { once: true });
|
|
4198
|
+
if (liveness.signal.aborted) stop();
|
|
4199
|
+
});
|
|
4200
|
+
}
|
|
4185
4201
|
} catch {
|
|
4186
4202
|
return false;
|
|
4187
4203
|
}
|
|
@@ -4210,9 +4226,11 @@ var HttpServerLink = class {
|
|
|
4210
4226
|
}
|
|
4211
4227
|
}
|
|
4212
4228
|
};
|
|
4229
|
+
if (!await gate.checkLive()) return "deny";
|
|
4213
4230
|
const created = await retry(() => this.call("POST", path, { body: { operation: "propose", deviceId: assignment.deviceId, policyRevision, requestId: request.requestId, harness: request.harness, method: request.method, input: request.input }, schema: proposal, signal: signal2 }));
|
|
4214
4231
|
try {
|
|
4215
4232
|
for (; ; ) {
|
|
4233
|
+
if (!await gate.checkLive()) return "deny";
|
|
4216
4234
|
const result = await retry(() => this.call("POST", path, { body: { operation: "take", deviceId: assignment.deviceId, id: created.id, digest: created.digest }, schema: response, signal: signal2 }));
|
|
4217
4235
|
if (result.decision !== "pending") return result.decision;
|
|
4218
4236
|
await delay();
|
package/login.js
CHANGED
|
@@ -3628,7 +3628,7 @@ var ServerUnreachableError = class extends DaemonError {
|
|
|
3628
3628
|
// package.json
|
|
3629
3629
|
var package_default = {
|
|
3630
3630
|
name: "@mikka/daemon",
|
|
3631
|
-
version: "0.0.
|
|
3631
|
+
version: "0.0.4",
|
|
3632
3632
|
description: "Local Mikka daemon: runs agents through the user's own CLIs",
|
|
3633
3633
|
type: "module",
|
|
3634
3634
|
private: true,
|
|
@@ -3686,7 +3686,7 @@ var package_default = {
|
|
|
3686
3686
|
engines: {
|
|
3687
3687
|
node: ">=24"
|
|
3688
3688
|
},
|
|
3689
|
-
gitHead: "
|
|
3689
|
+
gitHead: "4c5f80747928d60ea3e03ed6a3de5ca2dc2216df"
|
|
3690
3690
|
};
|
|
3691
3691
|
|
|
3692
3692
|
// src/paths.ts
|
package/main.js
CHANGED
|
@@ -2826,7 +2826,7 @@ import { join as join2 } from "node:path";
|
|
|
2826
2826
|
// package.json
|
|
2827
2827
|
var package_default = {
|
|
2828
2828
|
name: "@mikka/daemon",
|
|
2829
|
-
version: "0.0.
|
|
2829
|
+
version: "0.0.4",
|
|
2830
2830
|
description: "Local Mikka daemon: runs agents through the user's own CLIs",
|
|
2831
2831
|
type: "module",
|
|
2832
2832
|
private: true,
|
|
@@ -2884,7 +2884,7 @@ var package_default = {
|
|
|
2884
2884
|
engines: {
|
|
2885
2885
|
node: ">=24"
|
|
2886
2886
|
},
|
|
2887
|
-
gitHead: "
|
|
2887
|
+
gitHead: "4c5f80747928d60ea3e03ed6a3de5ca2dc2216df"
|
|
2888
2888
|
};
|
|
2889
2889
|
|
|
2890
2890
|
// src/paths.ts
|
|
@@ -11514,7 +11514,7 @@ var RunSupervisor = class {
|
|
|
11514
11514
|
const current = this.deps.journal.get(runId);
|
|
11515
11515
|
assertMailboxRunAuthority({ held: this.active.get(runId) === run2, state: current?.state, stopped: this.stopping || run2.cancelRequested || run2.abort.signal.aborted, lease });
|
|
11516
11516
|
};
|
|
11517
|
-
|
|
11517
|
+
let mailbox = await this.deps.prepareRunMailbox?.(assignment, run2.abort.signal, checkMailbox);
|
|
11518
11518
|
run2.mailbox = mailbox;
|
|
11519
11519
|
if (this.stopping) return;
|
|
11520
11520
|
if (run2.cancelRequested) {
|
|
@@ -11524,6 +11524,14 @@ var RunSupervisor = class {
|
|
|
11524
11524
|
if (mailbox) checkMailbox();
|
|
11525
11525
|
const toolApproval = await this.deps.prepareRunToolApproval?.(assignment, run2.abort.signal, checkMailbox, worktree);
|
|
11526
11526
|
run2.toolApproval = toolApproval;
|
|
11527
|
+
if (mailbox && toolApproval) {
|
|
11528
|
+
const original = mailbox;
|
|
11529
|
+
mailbox = { tools: original.tools, close: () => original.close(), request: async (body, signal) => {
|
|
11530
|
+
if (!await toolApproval.checkLive()) throw new Error("Run tool approval unavailable");
|
|
11531
|
+
return original.request(body, signal);
|
|
11532
|
+
} };
|
|
11533
|
+
run2.mailbox = mailbox;
|
|
11534
|
+
}
|
|
11527
11535
|
if (this.stopping) {
|
|
11528
11536
|
toolApproval?.revoke();
|
|
11529
11537
|
return;
|
package/mikka.js
CHANGED
|
@@ -4282,7 +4282,7 @@ import { join as join3 } from "node:path";
|
|
|
4282
4282
|
// package.json
|
|
4283
4283
|
var package_default = {
|
|
4284
4284
|
name: "@mikka/daemon",
|
|
4285
|
-
version: "0.0.
|
|
4285
|
+
version: "0.0.4",
|
|
4286
4286
|
description: "Local Mikka daemon: runs agents through the user's own CLIs",
|
|
4287
4287
|
type: "module",
|
|
4288
4288
|
private: true,
|
|
@@ -4340,7 +4340,7 @@ var package_default = {
|
|
|
4340
4340
|
engines: {
|
|
4341
4341
|
node: ">=24"
|
|
4342
4342
|
},
|
|
4343
|
-
gitHead: "
|
|
4343
|
+
gitHead: "4c5f80747928d60ea3e03ed6a3de5ca2dc2216df"
|
|
4344
4344
|
};
|
|
4345
4345
|
|
|
4346
4346
|
// src/paths.ts
|
|
@@ -4979,12 +4979,28 @@ var HttpServerLink = class {
|
|
|
4979
4979
|
const liveness = new AbortController();
|
|
4980
4980
|
const gate = new ToolApprovalGate(assignment.runId, {
|
|
4981
4981
|
permission: (request) => toolApprovalDecision(request, assignment.policy, worktree),
|
|
4982
|
+
// Keep the callback pending at the tool boundary. The adapter's current
|
|
4983
|
+
// session and checkpoint remain intact; handback resolves this same call.
|
|
4982
4984
|
isLive: async () => {
|
|
4983
4985
|
try {
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4986
|
+
for (; ; ) {
|
|
4987
|
+
check();
|
|
4988
|
+
const current = await this.call("POST", path, { body: { operation: "check", deviceId: assignment.deviceId, policyRevision }, schema: z25.object({ live: z25.boolean(), paused: z25.boolean().optional() }), signal: liveness.signal, timeoutMs: 5e3 });
|
|
4989
|
+
check();
|
|
4990
|
+
if (!current.live || !current.paused) return current.live;
|
|
4991
|
+
await new Promise((resolve10, reject) => {
|
|
4992
|
+
const stop = () => {
|
|
4993
|
+
clearTimeout(timer);
|
|
4994
|
+
reject(new Error("cancelled"));
|
|
4995
|
+
};
|
|
4996
|
+
const timer = setTimeout(() => {
|
|
4997
|
+
liveness.signal.removeEventListener("abort", stop);
|
|
4998
|
+
resolve10();
|
|
4999
|
+
}, 1e3);
|
|
5000
|
+
liveness.signal.addEventListener("abort", stop, { once: true });
|
|
5001
|
+
if (liveness.signal.aborted) stop();
|
|
5002
|
+
});
|
|
5003
|
+
}
|
|
4988
5004
|
} catch {
|
|
4989
5005
|
return false;
|
|
4990
5006
|
}
|
|
@@ -5013,9 +5029,11 @@ var HttpServerLink = class {
|
|
|
5013
5029
|
}
|
|
5014
5030
|
}
|
|
5015
5031
|
};
|
|
5032
|
+
if (!await gate.checkLive()) return "deny";
|
|
5016
5033
|
const created = await retry(() => this.call("POST", path, { body: { operation: "propose", deviceId: assignment.deviceId, policyRevision, requestId: request.requestId, harness: request.harness, method: request.method, input: request.input }, schema: proposal, signal: signal2 }));
|
|
5017
5034
|
try {
|
|
5018
5035
|
for (; ; ) {
|
|
5036
|
+
if (!await gate.checkLive()) return "deny";
|
|
5019
5037
|
const result = await retry(() => this.call("POST", path, { body: { operation: "take", deviceId: assignment.deviceId, id: created.id, digest: created.digest }, schema: response, signal: signal2 }));
|
|
5020
5038
|
if (result.decision !== "pending") return result.decision;
|
|
5021
5039
|
await delay3();
|
|
@@ -12339,7 +12357,7 @@ var RunSupervisor = class {
|
|
|
12339
12357
|
const current = this.deps.journal.get(runId);
|
|
12340
12358
|
assertMailboxRunAuthority({ held: this.active.get(runId) === run2, state: current?.state, stopped: this.stopping || run2.cancelRequested || run2.abort.signal.aborted, lease });
|
|
12341
12359
|
};
|
|
12342
|
-
|
|
12360
|
+
let mailbox = await this.deps.prepareRunMailbox?.(assignment, run2.abort.signal, checkMailbox);
|
|
12343
12361
|
run2.mailbox = mailbox;
|
|
12344
12362
|
if (this.stopping) return;
|
|
12345
12363
|
if (run2.cancelRequested) {
|
|
@@ -12349,6 +12367,14 @@ var RunSupervisor = class {
|
|
|
12349
12367
|
if (mailbox) checkMailbox();
|
|
12350
12368
|
const toolApproval = await this.deps.prepareRunToolApproval?.(assignment, run2.abort.signal, checkMailbox, worktree);
|
|
12351
12369
|
run2.toolApproval = toolApproval;
|
|
12370
|
+
if (mailbox && toolApproval) {
|
|
12371
|
+
const original = mailbox;
|
|
12372
|
+
mailbox = { tools: original.tools, close: () => original.close(), request: async (body, signal) => {
|
|
12373
|
+
if (!await toolApproval.checkLive()) throw new Error("Run tool approval unavailable");
|
|
12374
|
+
return original.request(body, signal);
|
|
12375
|
+
} };
|
|
12376
|
+
run2.mailbox = mailbox;
|
|
12377
|
+
}
|
|
12352
12378
|
if (this.stopping) {
|
|
12353
12379
|
toolApproval?.revoke();
|
|
12354
12380
|
return;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aspectlylabs/mikka",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Local Mikka daemon: runs agents through the user's own CLIs",
|
|
5
|
-
"gitHead": "
|
|
5
|
+
"gitHead": "4c5f80747928d60ea3e03ed6a3de5ca2dc2216df",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"private": false,
|
|
8
8
|
"license": "AGPL-3.0-only",
|
package/paths.js
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from "node:path";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@mikka/daemon",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.4",
|
|
10
10
|
description: "Local Mikka daemon: runs agents through the user's own CLIs",
|
|
11
11
|
type: "module",
|
|
12
12
|
private: true,
|
|
@@ -64,7 +64,7 @@ var package_default = {
|
|
|
64
64
|
engines: {
|
|
65
65
|
node: ">=24"
|
|
66
66
|
},
|
|
67
|
-
gitHead: "
|
|
67
|
+
gitHead: "4c5f80747928d60ea3e03ed6a3de5ca2dc2216df"
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// src/paths.ts
|