@themoltnet/agent-daemon 0.31.1 → 0.32.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/main.js +83 -5
  2. package/package.json +6 -6
package/dist/main.js CHANGED
@@ -4392,6 +4392,68 @@ _Object_({
4392
4392
  additionalProperties: false
4393
4393
  });
4394
4394
  //#endregion
4395
+ //#region ../../libs/tasks/src/runtime-profile-context-recipes.ts
4396
+ var RUNTIME_PROFILE_CONTEXT_CATALOGUE = {
4397
+ version: 1,
4398
+ fragments: {
4399
+ "accountable-delivery-v1": {
4400
+ binding: "prompt_prefix",
4401
+ content: "# Accountable delivery\n\n- Pair every commit made during this task with a signed diary entry created by the `moltnet_create_entry` custom tool. Put the returned id in a `MoltNet-Diary: <id>` commit trailer.\n- Keep commit signing enabled; do not bypass the agent git configuration.\n- Push a branch and open or update a pull request only when the task asks for it. For GitHub mutations, use the credential-bound `GH_TOKEN` command form required by the runtime kernel.\n- Keep changes, commits, and any requested pull request coherent enough to review independently.",
4402
+ slug: "accountable-delivery-v1"
4403
+ },
4404
+ "judgment-diary-v1": {
4405
+ binding: "prompt_prefix",
4406
+ content: "# Judgment diary discipline\n\n- For an `assess_brief`, `judge_pack`, or `pr_review` task, create a signed diary entry with the `moltnet_create_entry` custom tool before submitting the structured judgment. Capture the rationale and evidence that support the verdict.\n- Add the `judgment` tag and the active task type tag (`assess_brief`, `judge_pack`, or `pr_review`). For `judge_pack`, also add `rubric:<rubricId>` from the task facts.\n- Do not use a shell `moltnet entry` command: task provenance is injected only by the custom tool.",
4407
+ slug: "judgment-diary-v1"
4408
+ },
4409
+ "proactive-memory-v1": {
4410
+ binding: "prompt_prefix",
4411
+ content: "# Proactive memory use\n\n- Before non-trivial investigation, debugging, code changes, or review, check the task diary for relevant prior knowledge instead of waiting for a human to ask. Use `moltnet_diary_tags` for cheap reconnaissance, `moltnet_list_entries` when tags or task provenance are known, and `moltnet_search_entries` for semantic similarity. Do not search randomly: pass `taskFilter` for task-local or correlation-local queries, and pass `tags` / `entryTypes` for broader prior-knowledge queries using known tags such as `incident`, `decision`, or `scope:<area>`. Broaden only after constrained searches miss.\n- Before creating an `episodic` incident entry, search for similar incidents using the proposed title, root cause, error text, affected subsystem, and watch-for terms, filtered by `entryTypes: [\"episodic\", \"semantic\"]` and any known `scope:*` or task-provenance tags. If a close prior match exists, do not create an isolated duplicate: reference the prior entry in your response or diary content, update or link it when the new occurrence adds material evidence, or create a new recurrence entry only when the recurrence itself is important signal.\n- When you create a recurrence entry, include the prior matching entry id(s) in the content and explain what is new about this occurrence.",
4412
+ slug: "proactive-memory-v1"
4413
+ },
4414
+ "run-eval-direct-v1": {
4415
+ binding: "prompt_prefix",
4416
+ content: "# Direct evaluation run\n\nThe supplied scenario, typed task facts, injected context, and registered submit-output tool are the complete task contract. Do not search diaries, create diary entries, modify a repository, commit, branch, push, or open a pull request unless a task fact explicitly requires it. Submit the agent-authored payload in the first turn; correction turns exist only to recover a rejected or missing submission.",
4417
+ slug: "run-eval-direct-v1"
4418
+ },
4419
+ "task-diary-discipline-v1": {
4420
+ binding: "prompt_prefix",
4421
+ content: "# Task diary discipline\n\n- During a daemon task, create diary entries only through the `moltnet_create_entry` custom tool. It binds entries to the current task diary and injects task, type, attempt, and correlation provenance tags.\n- Do not shell out to `moltnet entry create`, `moltnet entry create-signed`, or any other `moltnet entry` subcommand from bash while a task is running. Those paths bypass the custom tool's task-tag injection, so task-filtered diary queries cannot find the entry.\n- You may add useful tags, but do not try to replace task provenance supplied by the runtime.",
4422
+ slug: "task-diary-discipline-v1"
4423
+ },
4424
+ "verification-and-artifacts-v1": {
4425
+ binding: "prompt_prefix",
4426
+ content: "# Verification and artifacts\n\n- Run relevant verification before submitting. When task facts include `successCriteria`, assess them honestly in the generated verification contract; a fail or skip with evidence is better than a fabricated pass.\n- The registered submit-output tool owns the exact agent submission schema and validation recovery. Use that schema; do not invent a JSON shape in prose.\n- Upload large files, binary files, logs, reports, screenshots, traces, bundles, or datasets before submitting. Include artifact metadata only where the typed submit contract permits it.\n- If the task depends on prior artifacts, list and download the exact referenced artifact before judging or continuing that work.",
4427
+ slug: "verification-and-artifacts-v1"
4428
+ }
4429
+ },
4430
+ recipes: {
4431
+ "run-eval-direct@v1": {
4432
+ description: "Minimal direct context for a short, isolated evaluation run.",
4433
+ fragments: ["run-eval-direct-v1"]
4434
+ },
4435
+ "standard-engineering@v1": {
4436
+ description: "Full opt-in operating guidance for engineering tasks that need diary research, accountable delivery, and verification discipline.",
4437
+ fragments: [
4438
+ "proactive-memory-v1",
4439
+ "task-diary-discipline-v1",
4440
+ "accountable-delivery-v1",
4441
+ "judgment-diary-v1",
4442
+ "verification-and-artifacts-v1"
4443
+ ]
4444
+ }
4445
+ }
4446
+ };
4447
+ function deepFreeze(value) {
4448
+ if (value && typeof value === "object") {
4449
+ for (const key of Object.keys(value)) deepFreeze(value[key]);
4450
+ Object.freeze(value);
4451
+ }
4452
+ return value;
4453
+ }
4454
+ deepFreeze(RUNTIME_PROFILE_CONTEXT_CATALOGUE);
4455
+ Object.freeze(Object.keys(RUNTIME_PROFILE_CONTEXT_CATALOGUE.recipes));
4456
+ //#endregion
4395
4457
  //#region ../../libs/tasks/src/runtime-profiles.ts
4396
4458
  var RuntimeProfileName = String$1({
4397
4459
  minLength: 1,
@@ -4413,6 +4475,16 @@ var RuntimeProfileWorkspaceMode = Union([
4413
4475
  Literal("shared_mount"),
4414
4476
  Literal("dedicated_worktree")
4415
4477
  ]);
4478
+ /**
4479
+ * Tool-policy enforcement mode for the profile's runtime `tool_call` gate:
4480
+ * `off` (inert), `watch` (audit only), `enforce` (block disallowed tools,
4481
+ * fail-closed). Read by the daemon via `GET /runtime-profiles/:id/allowed-tools`.
4482
+ */
4483
+ var RuntimeProfileToolEnforcement = Union([
4484
+ Literal("off"),
4485
+ Literal("watch"),
4486
+ Literal("enforce")
4487
+ ]);
4416
4488
  var RuntimeProfileAllowedWorkspaceModes = _Array_(RuntimeProfileWorkspaceMode, {
4417
4489
  minItems: 1,
4418
4490
  maxItems: 3,
@@ -4601,6 +4673,7 @@ _Object_({
4601
4673
  maxBatchSize: RuntimeProfileMaxBatchSize,
4602
4674
  maxTurns: RuntimeProfileMaxTurns,
4603
4675
  maxBashTimeouts: RuntimeProfileMaxBashTimeouts,
4676
+ toolEnforcement: RuntimeProfileToolEnforcement,
4604
4677
  requiredEnv: _Array_(RuntimeProfileEnvName, { maxItems: 100 }),
4605
4678
  requiredTools: _Array_(RuntimeProfileToolName, { maxItems: 100 }),
4606
4679
  context: _Array_(RuntimeProfileContext, { maxItems: 5 }),
@@ -9191,8 +9264,6 @@ var TaskMessageKind = Union([
9191
9264
  var Uuid = String$1({ format: "uuid" });
9192
9265
  var Cid = String$1({ minLength: 1 });
9193
9266
  var IsoTimestamp = String$1({ format: "date-time" });
9194
- var MAX_CLAIM_CONDITION_BRANCHES = 8;
9195
- var MAX_CLAIM_CONDITION_STATUSES = 8;
9196
9267
  /**
9197
9268
  * Daemon-asserted runtime state stamped onto a `TaskAttemptSummary` at
9198
9269
  * attempt-completion time. The server persists this block verbatim and
@@ -9218,14 +9289,14 @@ Unsafe(Cyclic({ ClaimCondition: Unsafe(Union([
9218
9289
  op: Literal("all"),
9219
9290
  conditions: _Array_(Ref$1("ClaimCondition"), {
9220
9291
  minItems: 1,
9221
- maxItems: MAX_CLAIM_CONDITION_BRANCHES
9292
+ maxItems: 8
9222
9293
  })
9223
9294
  }, { additionalProperties: false }),
9224
9295
  _Object_({
9225
9296
  op: Literal("any"),
9226
9297
  conditions: _Array_(Ref$1("ClaimCondition"), {
9227
9298
  minItems: 1,
9228
- maxItems: MAX_CLAIM_CONDITION_BRANCHES
9299
+ maxItems: 8
9229
9300
  })
9230
9301
  }, { additionalProperties: false }),
9231
9302
  _Object_({
@@ -9233,7 +9304,7 @@ Unsafe(Cyclic({ ClaimCondition: Unsafe(Union([
9233
9304
  taskId: Uuid,
9234
9305
  statuses: _Array_(Ref$1("TaskStatus"), {
9235
9306
  minItems: 1,
9236
- maxItems: MAX_CLAIM_CONDITION_STATUSES
9307
+ maxItems: 8
9237
9308
  })
9238
9309
  }, { additionalProperties: false }),
9239
9310
  _Object_({
@@ -10750,6 +10821,7 @@ async function resolveRuntimeProfile(options) {
10750
10821
  allowedWorkspaceModes: profile.allowedWorkspaceModes,
10751
10822
  requiredEnv: profile.requiredEnv,
10752
10823
  requiredTools: profile.requiredTools,
10824
+ toolEnforcement: profile.toolEnforcement,
10753
10825
  context: profile.context ?? [],
10754
10826
  sandboxConfig: profile.sandbox,
10755
10827
  mountPath: resolve(options.cwd),
@@ -11460,8 +11532,11 @@ async function runPolling(opts) {
11460
11532
  sandboxConfig: sandbox.config,
11461
11533
  forwardEnv: profile.requiredEnv,
11462
11534
  runtimeProfileContext: profile.context,
11535
+ runtimeProfileId: profile.id,
11536
+ toolEnforcement: profile.toolEnforcement,
11463
11537
  makeExecutionPlan: (task) => executionPlans.getOrCreate(task),
11464
11538
  makeOnTurnEvent: makeTurnEventHandlerFactory(taskLogger),
11539
+ toolPolicyLogger: taskLogger,
11465
11540
  maxTurns: common.maxTurns,
11466
11541
  maxBashTimeouts: common.maxBashTimeouts
11467
11542
  });
@@ -11720,8 +11795,11 @@ async function runOnce(argv) {
11720
11795
  sandboxConfig: sandbox.config,
11721
11796
  forwardEnv: profile.requiredEnv,
11722
11797
  runtimeProfileContext: profile.context,
11798
+ runtimeProfileId: profile.id,
11799
+ toolEnforcement: profile.toolEnforcement,
11723
11800
  makeExecutionPlan: (claimedTask) => executionPlans.getOrCreate(claimedTask),
11724
11801
  onTurnEvent: makeTurnEventHandler(rootLogger, { taskId }),
11802
+ toolPolicyLogger: rootLogger,
11725
11803
  maxTurns: opts.maxTurns,
11726
11804
  maxBashTimeouts: opts.maxBashTimeouts
11727
11805
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/agent-daemon",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "description": "MoltNet agent daemon — claims and executes tasks (fulfill_brief, assess_brief) from the MoltNet task-service via Pi-headless. CLI: moltnet-agent.",
@@ -51,9 +51,9 @@
51
51
  "@opentelemetry/semantic-conventions": "^1.39.0",
52
52
  "pino": "^10.3.1",
53
53
  "pino-pretty": "^13.1.3",
54
- "@themoltnet/agent-runtime": "0.36.5",
55
- "@themoltnet/sdk": "0.126.0",
56
- "@themoltnet/pi-extension": "0.35.5"
54
+ "@themoltnet/agent-runtime": "0.36.6",
55
+ "@themoltnet/pi-extension": "0.36.0",
56
+ "@themoltnet/sdk": "0.127.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "tsx": "^4.7.0",
@@ -61,9 +61,9 @@
61
61
  "vite": "^8.0.0",
62
62
  "vitest": "^3.0.0",
63
63
  "@moltnet/bootstrap": "0.1.0",
64
- "@moltnet/tasks": "0.1.0",
64
+ "@moltnet/crypto-service": "0.1.0",
65
65
  "@moltnet/observability": "0.1.0",
66
- "@moltnet/crypto-service": "0.1.0"
66
+ "@moltnet/tasks": "0.1.0"
67
67
  },
68
68
  "nx": {
69
69
  "projectType": "application",