@themoltnet/agent-daemon 0.41.1 → 0.42.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.
Files changed (2) hide show
  1. package/dist/cli.js +28 -5
  2. package/package.json +7 -7
package/dist/cli.js CHANGED
@@ -858,6 +858,23 @@ var DiaryGrantResponseSchema = Type.Object({
858
858
  });
859
859
  Type.Object({ grants: Type.Array(DiaryGrantResponseSchema) });
860
860
  Type.Object({ revoked: Type.Boolean() });
861
+ var TaskGrantRoleSchema = Type.Union([Type.Literal("writer"), Type.Literal("manager")]);
862
+ Type.Object({
863
+ subjectId: UuidSchema,
864
+ subjectNs: GrantSubjectNsSchema,
865
+ role: TaskGrantRoleSchema
866
+ });
867
+ Type.Object({
868
+ subjectId: UuidSchema,
869
+ subjectNs: GrantSubjectNsSchema,
870
+ role: TaskGrantRoleSchema
871
+ });
872
+ var TaskGrantResponseSchema = Type.Object({
873
+ subjectId: UuidSchema,
874
+ subjectNs: GrantSubjectNsSchema,
875
+ role: TaskGrantRoleSchema
876
+ });
877
+ Type.Object({ grants: Type.Array(TaskGrantResponseSchema) });
861
878
  Type.Object({ "x-moltnet-team-id": Type.String({
862
879
  format: "uuid",
863
880
  description: "Team ID (UUID) that will own the resource. Required."
@@ -4079,11 +4096,13 @@ async function maybeAttachWarmSlotContext(claimedTask, basePlan, stateDirs, slot
4079
4096
  if (resolution.kind === "remote-session") {
4080
4097
  const recoveredBranch = await sourceAttemptResolver.findOutputBranch({
4081
4098
  attemptN: continueFrom.attemptN,
4082
- taskId: continueFrom.taskId
4099
+ taskId: continueFrom.taskId,
4100
+ teamId: claimedTask.task.teamId
4083
4101
  });
4084
4102
  const recoveredRevision = recoveredBranch ? null : await sourceAttemptResolver.findInputRevision({
4085
4103
  attemptN: continueFrom.attemptN,
4086
- taskId: continueFrom.taskId
4104
+ taskId: continueFrom.taskId,
4105
+ teamId: claimedTask.task.teamId
4087
4106
  });
4088
4107
  if (continueFrom.mode === "fork") {
4089
4108
  if (recoveredBranch || recoveredRevision) {
@@ -4120,7 +4139,8 @@ async function maybeAttachWarmSlotContext(claimedTask, basePlan, stateDirs, slot
4120
4139
  const parentBranch = resolution.producerSlot.workspace?.worktreeBranch ?? null;
4121
4140
  const parentRevision = parentBranch ? null : await sourceAttemptResolver.findInputRevision({
4122
4141
  attemptN: continueFrom.attemptN,
4123
- taskId: continueFrom.taskId
4142
+ taskId: continueFrom.taskId,
4143
+ teamId: claimedTask.task.teamId
4124
4144
  });
4125
4145
  if (continueFrom.mode === "fork") {
4126
4146
  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 +5612,12 @@ function createApiSourceAttemptResolver(args) {
5592
5612
  const { agent } = args;
5593
5613
  return {
5594
5614
  async findOutputBranch(input) {
5595
- const attempt = (await agent.tasks.listAttempts(input.taskId)).find((candidate) => candidate.attemptN === input.attemptN);
5615
+ const attempt = (await agent.tasks.listAttempts(input.taskId, { teamId: input.teamId })).find((candidate) => candidate.attemptN === input.attemptN);
5596
5616
  if (!attempt || attempt.status !== "completed") return null;
5597
5617
  return resolveOutputBranch(attempt.output);
5598
5618
  },
5599
5619
  async findInputRevision(input) {
5600
- const task = await agent.tasks.get(input.taskId);
5620
+ const task = await agent.tasks.get(input.taskId, { teamId: input.teamId });
5601
5621
  if (task.status !== "completed" || task.acceptedAttemptN !== input.attemptN) return null;
5602
5622
  return resolveTaskWorkspaceRevision(task.input);
5603
5623
  }
@@ -6013,6 +6033,7 @@ async function runPolling(opts) {
6013
6033
  const selected = runtimeForClaimedTask(runtimes, claimedTask);
6014
6034
  return new ApiTaskReporter({
6015
6035
  tasks: ctx.agent.tasks,
6036
+ teamId: claimedTask.task.teamId,
6016
6037
  leaseTtlSec: selected.common.leaseTtlSec,
6017
6038
  heartbeatIntervalMs: selected.common.heartbeatIntervalMs,
6018
6039
  maxBatchSize: selected.common.maxBatchSize,
@@ -6641,12 +6662,14 @@ async function runOnce(argv, runtimeAdapter = defaultPiDaemonAdapter) {
6641
6662
  source: new ApiTaskSource({
6642
6663
  agent: ctx.agent,
6643
6664
  taskId,
6665
+ teamId: profile.teamId,
6644
6666
  leaseTtlSec: opts.leaseTtlSec,
6645
6667
  profileId: profile.id,
6646
6668
  executorFingerprint: preparedRuntime.attestor.fingerprint
6647
6669
  }),
6648
6670
  makeReporter: () => new ApiTaskReporter({
6649
6671
  tasks: ctx.agent.tasks,
6672
+ teamId: profile.teamId,
6650
6673
  leaseTtlSec: opts.leaseTtlSec,
6651
6674
  heartbeatIntervalMs: opts.heartbeatIntervalMs,
6652
6675
  maxBatchSize: opts.maxBatchSize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/agent-daemon",
3
- "version": "0.41.1",
3
+ "version": "0.42.0",
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.",
@@ -77,10 +77,10 @@
77
77
  "pino-opentelemetry-transport": "^3.0.0",
78
78
  "pino-pretty": "^13.1.3",
79
79
  "typebox": "^1.2.8",
80
- "@themoltnet/pi-runtime": "0.9.0",
81
- "@themoltnet/agent-runtime": "0.42.0",
82
- "@themoltnet/sdk": "0.133.0",
83
- "@themoltnet/os-keyring": "0.2.0"
80
+ "@themoltnet/agent-runtime": "0.43.0",
81
+ "@themoltnet/os-keyring": "0.2.0",
82
+ "@themoltnet/pi-runtime": "0.10.0",
83
+ "@themoltnet/sdk": "0.134.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "tsx": "^4.7.0",
@@ -90,9 +90,9 @@
90
90
  "vitest": "^3.0.0",
91
91
  "@moltnet/bootstrap": "0.1.0",
92
92
  "@moltnet/crypto-service": "0.1.0",
93
- "@moltnet/models": "0.1.0",
94
93
  "@moltnet/observability": "0.1.0",
95
- "@moltnet/tasks": "0.1.0"
94
+ "@moltnet/tasks": "0.1.0",
95
+ "@moltnet/models": "0.1.0"
96
96
  },
97
97
  "nx": {
98
98
  "projectType": "application",