@themoltnet/pi-runtime 0.18.0 → 0.18.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.
Files changed (2) hide show
  1. package/dist/index.js +51 -13
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -253,11 +253,54 @@ var CREDENTIAL_SCOPES = {
253
253
  TaskManage: "task:manage",
254
254
  TaskRead: "task:read",
255
255
  TaskWrite: "task:write",
256
+ TeamJoin: "team:join",
256
257
  TeamManage: "team:manage",
257
258
  TeamRead: "team:read"
258
259
  };
259
260
  var ALL_CREDENTIAL_SCOPES = Object.freeze(Object.values(CREDENTIAL_SCOPES));
260
- CREDENTIAL_SCOPES.AgentProfile, CREDENTIAL_SCOPES.CryptoSign, CREDENTIAL_SCOPES.RuntimeRead, CREDENTIAL_SCOPES.TaskRead, CREDENTIAL_SCOPES.TaskClaim, CREDENTIAL_SCOPES.TaskExecute;
261
+ /**
262
+ * What the agent daemon cannot run without, checked against
263
+ * `GET /agents/whoami` at startup. Task credentials attenuate it further to
264
+ * `task:execute` alone.
265
+ *
266
+ * This is the **boot floor**, and deliberately not the same list as
267
+ * `AGENT_CREDENTIAL_SCOPES`. A credential's scopes are fixed when it is minted
268
+ * and `POST /agent-keys` caps a new key at the scopes of the credential
269
+ * requesting it, so no key can ever widen itself. A scope added here therefore
270
+ * stops every daemon already in the field, and only a human with a Console
271
+ * session can mint the replacement. Add one only when the daemon genuinely
272
+ * cannot work without it; anything a caller merely benefits from belongs in
273
+ * `DAEMON_OPTIONAL_SCOPES`, where absence costs a capability instead.
274
+ *
275
+ * `crypto:sign` is part of the minimum because host-capability signing runs on
276
+ * the daemon's own credential: the local seed signer calls the signing-request
277
+ * endpoints, which require it. A grant without it produces a daemon that boots
278
+ * cleanly and then fails the first time guest code signs a diary entry or a
279
+ * commit.
280
+ */
281
+ var DAEMON_MINIMUM_SCOPES = [
282
+ CREDENTIAL_SCOPES.AgentProfile,
283
+ CREDENTIAL_SCOPES.CryptoSign,
284
+ CREDENTIAL_SCOPES.RuntimeRead,
285
+ CREDENTIAL_SCOPES.TaskRead,
286
+ CREDENTIAL_SCOPES.TaskClaim,
287
+ CREDENTIAL_SCOPES.TaskExecute
288
+ ];
289
+ /**
290
+ * Read and enrollment authority a daemon uses when it has it, and runs without
291
+ * when it does not: reading the teams it belongs to and their diaries, and
292
+ * joining a team it is not yet a member of.
293
+ *
294
+ * Which product surface each one enables is deliberately not recorded here.
295
+ * That mapping belongs to whatever consumes the scope and changes with it,
296
+ * while the scope names are the contract and do not.
297
+ */
298
+ var DAEMON_OPTIONAL_SCOPES = [
299
+ CREDENTIAL_SCOPES.DiaryRead,
300
+ CREDENTIAL_SCOPES.TeamRead,
301
+ CREDENTIAL_SCOPES.TeamJoin
302
+ ];
303
+ [...DAEMON_MINIMUM_SCOPES, ...DAEMON_OPTIONAL_SCOPES];
261
304
  CREDENTIAL_SCOPES.AgentProfile, CREDENTIAL_SCOPES.TaskRead, CREDENTIAL_SCOPES.TaskWrite;
262
305
  CREDENTIAL_SCOPES.AgentProfile, CREDENTIAL_SCOPES.DiaryRead, CREDENTIAL_SCOPES.PackRead, CREDENTIAL_SCOPES.RuntimeRead, CREDENTIAL_SCOPES.TaskRead, CREDENTIAL_SCOPES.TeamRead;
263
306
  Object.freeze(ALL_CREDENTIAL_SCOPES.filter((scope) => scope !== CREDENTIAL_SCOPES.HumanProfile));
@@ -281,6 +324,7 @@ var MCP_CLIENT_SCOPES = [
281
324
  CREDENTIAL_SCOPES.TaskManage,
282
325
  CREDENTIAL_SCOPES.TaskRead,
283
326
  CREDENTIAL_SCOPES.TaskWrite,
327
+ CREDENTIAL_SCOPES.TeamJoin,
284
328
  CREDENTIAL_SCOPES.TeamManage,
285
329
  CREDENTIAL_SCOPES.TeamRead
286
330
  ];
@@ -634,17 +678,16 @@ Type.Object({
634
678
  Type.Literal("executor"),
635
679
  Type.Literal("member")
636
680
  ])),
637
- maxUses: Type.Optional(Type.Integer({
638
- minimum: 1,
639
- default: 1
640
- })),
641
681
  expiresInHours: Type.Optional(Type.Integer({
642
682
  minimum: 1,
643
683
  maximum: 720,
644
684
  default: 168
645
685
  }))
646
686
  });
647
- Type.Object({ code: Type.String({ minLength: 1 }) });
687
+ Type.Object({
688
+ code: Type.String({ minLength: 1 }),
689
+ issueAgentKey: Type.Optional(Type.Literal(true))
690
+ });
648
691
  Type.Object({ role: Type.Union([
649
692
  Type.Literal("manager"),
650
693
  Type.Literal("executor"),
@@ -669,8 +712,7 @@ Type.Object({
669
712
  Type.Literal("executor"),
670
713
  Type.Literal("member")
671
714
  ]),
672
- maxUses: Type.Integer(),
673
- useCount: Type.Integer(),
715
+ usedAt: Type.Union([Type.String({ format: "date-time" }), Type.Null()]),
674
716
  expiresAt: DateTimeUnsafe,
675
717
  createdAt: DateTimeUnsafe
676
718
  });
@@ -701,11 +743,7 @@ Type.Object({
701
743
  });
702
744
  Type.Object({
703
745
  teamId: UuidSchema,
704
- role: Type.Union([
705
- Type.Literal("manager"),
706
- Type.Literal("executor"),
707
- Type.Literal("member")
708
- ])
746
+ role: TeamRoleSchema
709
747
  });
710
748
  Type.Object({
711
749
  updated: Type.Boolean(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/pi-runtime",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Composable MoltNet runtime kernel for Pi agents in Gondolin VMs",
@@ -39,10 +39,10 @@
39
39
  "@opentelemetry/api": "^1.9.1",
40
40
  "multiformats": "^13.3.0",
41
41
  "typebox": "^1.2.8",
42
- "@themoltnet/agent-runtime": "1.0.3",
43
- "@themoltnet/sandbox-gondolin": "0.5.1",
42
+ "@themoltnet/agent-runtime": "1.1.0",
44
43
  "@themoltnet/os-keyring": "0.3.0",
45
- "@themoltnet/sdk": "0.142.0",
44
+ "@themoltnet/sdk": "0.143.0",
45
+ "@themoltnet/sandbox-gondolin": "0.5.1",
46
46
  "@themoltnet/shell-command-analyzer": "0.4.0"
47
47
  },
48
48
  "peerDependencies": {
@@ -60,10 +60,10 @@
60
60
  "vite": "^8.0.0",
61
61
  "vite-plugin-dts": "^4.5.4",
62
62
  "vitest": "^3.0.0",
63
+ "@moltnet/models": "0.1.0",
63
64
  "@moltnet/crypto-service": "0.1.0",
64
65
  "@moltnet/runtime-profiles": "0.1.0",
65
- "@moltnet/tasks": "0.1.0",
66
- "@moltnet/models": "0.1.0"
66
+ "@moltnet/tasks": "0.1.0"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=24"