@themoltnet/agent-daemon 0.41.1 → 0.42.1
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/cli.js +33 -8
- package/package.json +7 -6
package/dist/cli.js
CHANGED
|
@@ -23,6 +23,8 @@ import { ed25519 } from "@noble/curves/ed25519.js";
|
|
|
23
23
|
import * as ed from "@noble/ed25519";
|
|
24
24
|
import { createHash as createHash$1, randomBytes } from "crypto";
|
|
25
25
|
import "@ipld/dag-cbor";
|
|
26
|
+
import "@noble/ciphers/chacha";
|
|
27
|
+
import "@noble/hashes/hkdf";
|
|
26
28
|
import { once } from "node:events";
|
|
27
29
|
import { pino, transport } from "pino";
|
|
28
30
|
import { metrics } from "@opentelemetry/api";
|
|
@@ -672,10 +674,10 @@ Type.Object({
|
|
|
672
674
|
Type.Literal("completed"),
|
|
673
675
|
Type.Literal("failed")
|
|
674
676
|
]),
|
|
675
|
-
githubCode: Type.Optional(Type.String()),
|
|
677
|
+
githubCode: Type.Optional(Type.String({ description: "GitHub manifest code sealed to the onboarding agent public key." })),
|
|
676
678
|
identityId: Type.Optional(Type.String()),
|
|
677
679
|
clientId: Type.Optional(Type.String()),
|
|
678
|
-
clientSecret: Type.Optional(Type.String()),
|
|
680
|
+
clientSecret: Type.Optional(Type.String({ description: "OAuth2 client secret sealed to the onboarding agent public key." })),
|
|
679
681
|
installationId: Type.Optional(Type.String())
|
|
680
682
|
});
|
|
681
683
|
Type.Object({
|
|
@@ -858,6 +860,23 @@ var DiaryGrantResponseSchema = Type.Object({
|
|
|
858
860
|
});
|
|
859
861
|
Type.Object({ grants: Type.Array(DiaryGrantResponseSchema) });
|
|
860
862
|
Type.Object({ revoked: Type.Boolean() });
|
|
863
|
+
var TaskGrantRoleSchema = Type.Union([Type.Literal("writer"), Type.Literal("manager")]);
|
|
864
|
+
Type.Object({
|
|
865
|
+
subjectId: UuidSchema,
|
|
866
|
+
subjectNs: GrantSubjectNsSchema,
|
|
867
|
+
role: TaskGrantRoleSchema
|
|
868
|
+
});
|
|
869
|
+
Type.Object({
|
|
870
|
+
subjectId: UuidSchema,
|
|
871
|
+
subjectNs: GrantSubjectNsSchema,
|
|
872
|
+
role: TaskGrantRoleSchema
|
|
873
|
+
});
|
|
874
|
+
var TaskGrantResponseSchema = Type.Object({
|
|
875
|
+
subjectId: UuidSchema,
|
|
876
|
+
subjectNs: GrantSubjectNsSchema,
|
|
877
|
+
role: TaskGrantRoleSchema
|
|
878
|
+
});
|
|
879
|
+
Type.Object({ grants: Type.Array(TaskGrantResponseSchema) });
|
|
861
880
|
Type.Object({ "x-moltnet-team-id": Type.String({
|
|
862
881
|
format: "uuid",
|
|
863
882
|
description: "Team ID (UUID) that will own the resource. Required."
|
|
@@ -3233,7 +3252,7 @@ Type.Object({
|
|
|
3233
3252
|
allowedProfiles: Type.Array(RuntimeProfileRef, { maxItems: 16 }),
|
|
3234
3253
|
status: TaskStatus,
|
|
3235
3254
|
queuedAt: IsoTimestamp,
|
|
3236
|
-
completedAt: Type.Union([IsoTimestamp, Type.Null()]),
|
|
3255
|
+
completedAt: Type.Union([IsoTimestamp, Type.Null()], { description: "First time the task entered completed, failed, cancelled, or expired; null until terminal." }),
|
|
3237
3256
|
expiresAt: Type.Union([IsoTimestamp, Type.Null()]),
|
|
3238
3257
|
cancelledByAgentId: Type.Union([Uuid, Type.Null()]),
|
|
3239
3258
|
cancelledByHumanId: Type.Union([Uuid, Type.Null()]),
|
|
@@ -4079,11 +4098,13 @@ async function maybeAttachWarmSlotContext(claimedTask, basePlan, stateDirs, slot
|
|
|
4079
4098
|
if (resolution.kind === "remote-session") {
|
|
4080
4099
|
const recoveredBranch = await sourceAttemptResolver.findOutputBranch({
|
|
4081
4100
|
attemptN: continueFrom.attemptN,
|
|
4082
|
-
taskId: continueFrom.taskId
|
|
4101
|
+
taskId: continueFrom.taskId,
|
|
4102
|
+
teamId: claimedTask.task.teamId
|
|
4083
4103
|
});
|
|
4084
4104
|
const recoveredRevision = recoveredBranch ? null : await sourceAttemptResolver.findInputRevision({
|
|
4085
4105
|
attemptN: continueFrom.attemptN,
|
|
4086
|
-
taskId: continueFrom.taskId
|
|
4106
|
+
taskId: continueFrom.taskId,
|
|
4107
|
+
teamId: claimedTask.task.teamId
|
|
4087
4108
|
});
|
|
4088
4109
|
if (continueFrom.mode === "fork") {
|
|
4089
4110
|
if (recoveredBranch || recoveredRevision) {
|
|
@@ -4120,7 +4141,8 @@ async function maybeAttachWarmSlotContext(claimedTask, basePlan, stateDirs, slot
|
|
|
4120
4141
|
const parentBranch = resolution.producerSlot.workspace?.worktreeBranch ?? null;
|
|
4121
4142
|
const parentRevision = parentBranch ? null : await sourceAttemptResolver.findInputRevision({
|
|
4122
4143
|
attemptN: continueFrom.attemptN,
|
|
4123
|
-
taskId: continueFrom.taskId
|
|
4144
|
+
taskId: continueFrom.taskId,
|
|
4145
|
+
teamId: claimedTask.task.teamId
|
|
4124
4146
|
});
|
|
4125
4147
|
if (continueFrom.mode === "fork") {
|
|
4126
4148
|
if (!parentBranch && !parentRevision) throw new ProducerContextResolutionError(`Cannot fork continuation of ${continueFrom.taskId}/${continueFrom.attemptN}: producer slot has no worktree branch or immutable revision to fork from`);
|
|
@@ -5592,12 +5614,12 @@ function createApiSourceAttemptResolver(args) {
|
|
|
5592
5614
|
const { agent } = args;
|
|
5593
5615
|
return {
|
|
5594
5616
|
async findOutputBranch(input) {
|
|
5595
|
-
const attempt = (await agent.tasks.listAttempts(input.taskId)).find((candidate) => candidate.attemptN === input.attemptN);
|
|
5617
|
+
const attempt = (await agent.tasks.listAttempts(input.taskId, { teamId: input.teamId })).find((candidate) => candidate.attemptN === input.attemptN);
|
|
5596
5618
|
if (!attempt || attempt.status !== "completed") return null;
|
|
5597
5619
|
return resolveOutputBranch(attempt.output);
|
|
5598
5620
|
},
|
|
5599
5621
|
async findInputRevision(input) {
|
|
5600
|
-
const task = await agent.tasks.get(input.taskId);
|
|
5622
|
+
const task = await agent.tasks.get(input.taskId, { teamId: input.teamId });
|
|
5601
5623
|
if (task.status !== "completed" || task.acceptedAttemptN !== input.attemptN) return null;
|
|
5602
5624
|
return resolveTaskWorkspaceRevision(task.input);
|
|
5603
5625
|
}
|
|
@@ -6013,6 +6035,7 @@ async function runPolling(opts) {
|
|
|
6013
6035
|
const selected = runtimeForClaimedTask(runtimes, claimedTask);
|
|
6014
6036
|
return new ApiTaskReporter({
|
|
6015
6037
|
tasks: ctx.agent.tasks,
|
|
6038
|
+
teamId: claimedTask.task.teamId,
|
|
6016
6039
|
leaseTtlSec: selected.common.leaseTtlSec,
|
|
6017
6040
|
heartbeatIntervalMs: selected.common.heartbeatIntervalMs,
|
|
6018
6041
|
maxBatchSize: selected.common.maxBatchSize,
|
|
@@ -6641,12 +6664,14 @@ async function runOnce(argv, runtimeAdapter = defaultPiDaemonAdapter) {
|
|
|
6641
6664
|
source: new ApiTaskSource({
|
|
6642
6665
|
agent: ctx.agent,
|
|
6643
6666
|
taskId,
|
|
6667
|
+
teamId: profile.teamId,
|
|
6644
6668
|
leaseTtlSec: opts.leaseTtlSec,
|
|
6645
6669
|
profileId: profile.id,
|
|
6646
6670
|
executorFingerprint: preparedRuntime.attestor.fingerprint
|
|
6647
6671
|
}),
|
|
6648
6672
|
makeReporter: () => new ApiTaskReporter({
|
|
6649
6673
|
tasks: ctx.agent.tasks,
|
|
6674
|
+
teamId: profile.teamId,
|
|
6650
6675
|
leaseTtlSec: opts.leaseTtlSec,
|
|
6651
6676
|
heartbeatIntervalMs: opts.heartbeatIntervalMs,
|
|
6652
6677
|
maxBatchSize: opts.maxBatchSize,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/agent-daemon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Universal MoltNet agent daemon host with a built-in Pi/Gondolin runtime and support for trusted operator-owned runtime modules. CLI: moltnet-agent.",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@earendil-works/pi-coding-agent": "0.79.4",
|
|
53
53
|
"@fastify/otel": "^0.18.0",
|
|
54
54
|
"@ipld/dag-cbor": "^9.2.5",
|
|
55
|
+
"@noble/ciphers": "^1.2.0",
|
|
55
56
|
"@noble/curves": "^2.0.0",
|
|
56
57
|
"@noble/ed25519": "^2.0.0",
|
|
57
58
|
"@noble/hashes": "^1.7.0",
|
|
@@ -77,9 +78,9 @@
|
|
|
77
78
|
"pino-opentelemetry-transport": "^3.0.0",
|
|
78
79
|
"pino-pretty": "^13.1.3",
|
|
79
80
|
"typebox": "^1.2.8",
|
|
80
|
-
"@themoltnet/
|
|
81
|
-
"@themoltnet/
|
|
82
|
-
"@themoltnet/sdk": "0.
|
|
81
|
+
"@themoltnet/agent-runtime": "0.43.1",
|
|
82
|
+
"@themoltnet/pi-runtime": "0.10.1",
|
|
83
|
+
"@themoltnet/sdk": "0.135.0",
|
|
83
84
|
"@themoltnet/os-keyring": "0.2.0"
|
|
84
85
|
},
|
|
85
86
|
"devDependencies": {
|
|
@@ -88,10 +89,10 @@
|
|
|
88
89
|
"vite": "^8.0.0",
|
|
89
90
|
"vite-plugin-dts": "^4.5.4",
|
|
90
91
|
"vitest": "^3.0.0",
|
|
91
|
-
"@moltnet/bootstrap": "0.1.0",
|
|
92
92
|
"@moltnet/crypto-service": "0.1.0",
|
|
93
|
-
"@moltnet/
|
|
93
|
+
"@moltnet/bootstrap": "0.1.0",
|
|
94
94
|
"@moltnet/observability": "0.1.0",
|
|
95
|
+
"@moltnet/models": "0.1.0",
|
|
95
96
|
"@moltnet/tasks": "0.1.0"
|
|
96
97
|
},
|
|
97
98
|
"nx": {
|