@themoltnet/node-red-contrib-core 0.12.5 → 0.12.7

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/nodes/src.js +339 -5
  2. package/package.json +2 -2
package/dist/nodes/src.js CHANGED
@@ -2000,6 +2000,124 @@ var updateRenderedPack = (options) => (options.client ?? client).patch({
2000
2000
  }
2001
2001
  });
2002
2002
  /**
2003
+ * List tool policies for the active team.
2004
+ */
2005
+ var listRuntimePolicies = (options) => (options.client ?? client).get({
2006
+ security: [
2007
+ {
2008
+ scheme: "bearer",
2009
+ type: "http"
2010
+ },
2011
+ {
2012
+ name: "X-Moltnet-Session-Token",
2013
+ type: "apiKey"
2014
+ },
2015
+ {
2016
+ in: "cookie",
2017
+ name: "ory_kratos_session",
2018
+ type: "apiKey"
2019
+ }
2020
+ ],
2021
+ url: "/runtime-policies",
2022
+ ...options
2023
+ });
2024
+ /**
2025
+ * Create a team-scoped tool policy granting a set of tools.
2026
+ */
2027
+ var createRuntimePolicy = (options) => (options.client ?? client).post({
2028
+ security: [
2029
+ {
2030
+ scheme: "bearer",
2031
+ type: "http"
2032
+ },
2033
+ {
2034
+ name: "X-Moltnet-Session-Token",
2035
+ type: "apiKey"
2036
+ },
2037
+ {
2038
+ in: "cookie",
2039
+ name: "ory_kratos_session",
2040
+ type: "apiKey"
2041
+ }
2042
+ ],
2043
+ url: "/runtime-policies",
2044
+ ...options,
2045
+ headers: {
2046
+ "Content-Type": "application/json",
2047
+ ...options.headers
2048
+ }
2049
+ });
2050
+ /**
2051
+ * Delete a tool policy and its tool grants.
2052
+ */
2053
+ var deleteRuntimePolicy = (options) => (options.client ?? client).delete({
2054
+ security: [
2055
+ {
2056
+ scheme: "bearer",
2057
+ type: "http"
2058
+ },
2059
+ {
2060
+ name: "X-Moltnet-Session-Token",
2061
+ type: "apiKey"
2062
+ },
2063
+ {
2064
+ in: "cookie",
2065
+ name: "ory_kratos_session",
2066
+ type: "apiKey"
2067
+ }
2068
+ ],
2069
+ url: "/runtime-policies/{policyId}",
2070
+ ...options
2071
+ });
2072
+ /**
2073
+ * Get one tool policy with its granted tools.
2074
+ */
2075
+ var getRuntimePolicy = (options) => (options.client ?? client).get({
2076
+ security: [
2077
+ {
2078
+ scheme: "bearer",
2079
+ type: "http"
2080
+ },
2081
+ {
2082
+ name: "X-Moltnet-Session-Token",
2083
+ type: "apiKey"
2084
+ },
2085
+ {
2086
+ in: "cookie",
2087
+ name: "ory_kratos_session",
2088
+ type: "apiKey"
2089
+ }
2090
+ ],
2091
+ url: "/runtime-policies/{policyId}",
2092
+ ...options
2093
+ });
2094
+ /**
2095
+ * Rename a policy and/or add/remove granted tools.
2096
+ */
2097
+ var updateRuntimePolicy = (options) => (options.client ?? client).patch({
2098
+ security: [
2099
+ {
2100
+ scheme: "bearer",
2101
+ type: "http"
2102
+ },
2103
+ {
2104
+ name: "X-Moltnet-Session-Token",
2105
+ type: "apiKey"
2106
+ },
2107
+ {
2108
+ in: "cookie",
2109
+ name: "ory_kratos_session",
2110
+ type: "apiKey"
2111
+ }
2112
+ ],
2113
+ url: "/runtime-policies/{policyId}",
2114
+ ...options,
2115
+ headers: {
2116
+ "Content-Type": "application/json",
2117
+ ...options.headers
2118
+ }
2119
+ });
2120
+ /**
2003
2121
  * List runtime profiles for the active team context.
2004
2122
  */
2005
2123
  var listRuntimeProfiles = (options) => (options?.client ?? client).get({
@@ -2118,6 +2236,76 @@ var updateRuntimeProfile = (options) => (options.client ?? client).patch({
2118
2236
  }
2119
2237
  });
2120
2238
  /**
2239
+ * Resolve a runtime profile enforcement mode and its allowed-tool set (union of bound policies).
2240
+ */
2241
+ var getRuntimeProfileAllowedTools = (options) => (options.client ?? client).get({
2242
+ security: [
2243
+ {
2244
+ scheme: "bearer",
2245
+ type: "http"
2246
+ },
2247
+ {
2248
+ name: "X-Moltnet-Session-Token",
2249
+ type: "apiKey"
2250
+ },
2251
+ {
2252
+ in: "cookie",
2253
+ name: "ory_kratos_session",
2254
+ type: "apiKey"
2255
+ }
2256
+ ],
2257
+ url: "/runtime-profiles/{profileId}/allowed-tools",
2258
+ ...options
2259
+ });
2260
+ /**
2261
+ * List the tool-policy IDs bound to a runtime profile.
2262
+ */
2263
+ var getRuntimeProfilePolicies = (options) => (options.client ?? client).get({
2264
+ security: [
2265
+ {
2266
+ scheme: "bearer",
2267
+ type: "http"
2268
+ },
2269
+ {
2270
+ name: "X-Moltnet-Session-Token",
2271
+ type: "apiKey"
2272
+ },
2273
+ {
2274
+ in: "cookie",
2275
+ name: "ory_kratos_session",
2276
+ type: "apiKey"
2277
+ }
2278
+ ],
2279
+ url: "/runtime-profiles/{profileId}/policies",
2280
+ ...options
2281
+ });
2282
+ /**
2283
+ * Replace the set of tool policies bound to a runtime profile.
2284
+ */
2285
+ var setRuntimeProfilePolicies = (options) => (options.client ?? client).put({
2286
+ security: [
2287
+ {
2288
+ scheme: "bearer",
2289
+ type: "http"
2290
+ },
2291
+ {
2292
+ name: "X-Moltnet-Session-Token",
2293
+ type: "apiKey"
2294
+ },
2295
+ {
2296
+ in: "cookie",
2297
+ name: "ory_kratos_session",
2298
+ type: "apiKey"
2299
+ }
2300
+ ],
2301
+ url: "/runtime-profiles/{profileId}/policies",
2302
+ ...options,
2303
+ headers: {
2304
+ "Content-Type": "application/json",
2305
+ ...options.headers
2306
+ }
2307
+ });
2308
+ /**
2121
2309
  * Get metadata for the durable team-scoped runtime session for a task attempt.
2122
2310
  */
2123
2311
  var getRuntimeSession = (options) => (options.client ?? client).get({
@@ -5478,6 +5666,54 @@ function createRecoveryNamespace(context) {
5478
5666
  };
5479
5667
  }
5480
5668
  //#endregion
5669
+ //#region ../sdk/src/namespaces/runtime-policies.ts
5670
+ function createRuntimePoliciesNamespace(context) {
5671
+ const { client, auth } = context;
5672
+ return {
5673
+ async create(body, options) {
5674
+ return unwrapResult(await createRuntimePolicy({
5675
+ client,
5676
+ auth,
5677
+ headers: requiredTeamHeaders(options),
5678
+ body
5679
+ }));
5680
+ },
5681
+ async list(options) {
5682
+ return unwrapResult(await listRuntimePolicies({
5683
+ client,
5684
+ auth,
5685
+ headers: requiredTeamHeaders(options)
5686
+ }));
5687
+ },
5688
+ async get(policyId, options) {
5689
+ return unwrapResult(await getRuntimePolicy({
5690
+ client,
5691
+ auth,
5692
+ path: { policyId },
5693
+ headers: requiredTeamHeaders(options)
5694
+ }));
5695
+ },
5696
+ async update(policyId, body, options) {
5697
+ return unwrapResult(await updateRuntimePolicy({
5698
+ client,
5699
+ auth,
5700
+ path: { policyId },
5701
+ headers: requiredTeamHeaders(options),
5702
+ body
5703
+ }));
5704
+ },
5705
+ async delete(policyId, options) {
5706
+ const result = await deleteRuntimePolicy({
5707
+ client,
5708
+ auth,
5709
+ path: { policyId },
5710
+ headers: requiredTeamHeaders(options)
5711
+ });
5712
+ if (result.error) unwrapResult(result);
5713
+ }
5714
+ };
5715
+ }
5716
+ //#endregion
5481
5717
  //#region ../sdk/src/namespaces/runtime-profiles.ts
5482
5718
  function createRuntimeProfilesNamespace(context) {
5483
5719
  const { client, auth } = context;
@@ -5519,6 +5755,32 @@ function createRuntimeProfilesNamespace(context) {
5519
5755
  path: { profileId }
5520
5756
  });
5521
5757
  if (result.error) unwrapResult(result);
5758
+ },
5759
+ async allowedTools(profileId, options) {
5760
+ return unwrapResult(await getRuntimeProfileAllowedTools({
5761
+ client,
5762
+ auth,
5763
+ path: { profileId },
5764
+ headers: requiredTeamHeaders(options)
5765
+ }));
5766
+ },
5767
+ async setPolicies(profileId, policyIds, options) {
5768
+ const result = await setRuntimeProfilePolicies({
5769
+ client,
5770
+ auth,
5771
+ path: { profileId },
5772
+ headers: requiredTeamHeaders(options),
5773
+ body: { policyIds }
5774
+ });
5775
+ if (result.error) unwrapResult(result);
5776
+ },
5777
+ async getPolicies(profileId, options) {
5778
+ return unwrapResult(await getRuntimeProfilePolicies({
5779
+ client,
5780
+ auth,
5781
+ path: { profileId },
5782
+ headers: requiredTeamHeaders(options)
5783
+ }));
5522
5784
  }
5523
5785
  };
5524
5786
  }
@@ -10031,6 +10293,68 @@ _Object_({
10031
10293
  additionalProperties: false
10032
10294
  });
10033
10295
  //#endregion
10296
+ //#region ../tasks/src/runtime-profile-context-recipes.ts
10297
+ var RUNTIME_PROFILE_CONTEXT_CATALOGUE = {
10298
+ version: 1,
10299
+ fragments: {
10300
+ "accountable-delivery-v1": {
10301
+ binding: "prompt_prefix",
10302
+ 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.",
10303
+ slug: "accountable-delivery-v1"
10304
+ },
10305
+ "judgment-diary-v1": {
10306
+ binding: "prompt_prefix",
10307
+ 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.",
10308
+ slug: "judgment-diary-v1"
10309
+ },
10310
+ "proactive-memory-v1": {
10311
+ binding: "prompt_prefix",
10312
+ 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.",
10313
+ slug: "proactive-memory-v1"
10314
+ },
10315
+ "run-eval-direct-v1": {
10316
+ binding: "prompt_prefix",
10317
+ 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.",
10318
+ slug: "run-eval-direct-v1"
10319
+ },
10320
+ "task-diary-discipline-v1": {
10321
+ binding: "prompt_prefix",
10322
+ 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.",
10323
+ slug: "task-diary-discipline-v1"
10324
+ },
10325
+ "verification-and-artifacts-v1": {
10326
+ binding: "prompt_prefix",
10327
+ 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.",
10328
+ slug: "verification-and-artifacts-v1"
10329
+ }
10330
+ },
10331
+ recipes: {
10332
+ "run-eval-direct@v1": {
10333
+ description: "Minimal direct context for a short, isolated evaluation run.",
10334
+ fragments: ["run-eval-direct-v1"]
10335
+ },
10336
+ "standard-engineering@v1": {
10337
+ description: "Full opt-in operating guidance for engineering tasks that need diary research, accountable delivery, and verification discipline.",
10338
+ fragments: [
10339
+ "proactive-memory-v1",
10340
+ "task-diary-discipline-v1",
10341
+ "accountable-delivery-v1",
10342
+ "judgment-diary-v1",
10343
+ "verification-and-artifacts-v1"
10344
+ ]
10345
+ }
10346
+ }
10347
+ };
10348
+ function deepFreeze(value) {
10349
+ if (value && typeof value === "object") {
10350
+ for (const key of Object.keys(value)) deepFreeze(value[key]);
10351
+ Object.freeze(value);
10352
+ }
10353
+ return value;
10354
+ }
10355
+ deepFreeze(RUNTIME_PROFILE_CONTEXT_CATALOGUE);
10356
+ Object.freeze(Object.keys(RUNTIME_PROFILE_CONTEXT_CATALOGUE.recipes));
10357
+ //#endregion
10034
10358
  //#region ../tasks/src/runtime-profiles.ts
10035
10359
  var RuntimeProfileName = String$1({
10036
10360
  minLength: 1,
@@ -10052,6 +10376,16 @@ var RuntimeProfileWorkspaceMode = Union([
10052
10376
  Literal("shared_mount"),
10053
10377
  Literal("dedicated_worktree")
10054
10378
  ]);
10379
+ /**
10380
+ * Tool-policy enforcement mode for the profile's runtime `tool_call` gate:
10381
+ * `off` (inert), `watch` (audit only), `enforce` (block disallowed tools,
10382
+ * fail-closed). Read by the daemon via `GET /runtime-profiles/:id/allowed-tools`.
10383
+ */
10384
+ var RuntimeProfileToolEnforcement = Union([
10385
+ Literal("off"),
10386
+ Literal("watch"),
10387
+ Literal("enforce")
10388
+ ]);
10055
10389
  var RuntimeProfileAllowedWorkspaceModes = _Array_(RuntimeProfileWorkspaceMode, {
10056
10390
  minItems: 1,
10057
10391
  maxItems: 3,
@@ -10240,6 +10574,7 @@ _Object_({
10240
10574
  maxBatchSize: RuntimeProfileMaxBatchSize,
10241
10575
  maxTurns: RuntimeProfileMaxTurns,
10242
10576
  maxBashTimeouts: RuntimeProfileMaxBashTimeouts,
10577
+ toolEnforcement: RuntimeProfileToolEnforcement,
10243
10578
  requiredEnv: _Array_(RuntimeProfileEnvName, { maxItems: 100 }),
10244
10579
  requiredTools: _Array_(RuntimeProfileToolName, { maxItems: 100 }),
10245
10580
  context: _Array_(RuntimeProfileContext, { maxItems: 5 }),
@@ -14458,8 +14793,6 @@ var TaskMessageKind = Union([
14458
14793
  var Uuid = String$1({ format: "uuid" });
14459
14794
  var Cid = String$1({ minLength: 1 });
14460
14795
  var IsoTimestamp = String$1({ format: "date-time" });
14461
- var MAX_CLAIM_CONDITION_BRANCHES = 8;
14462
- var MAX_CLAIM_CONDITION_STATUSES = 8;
14463
14796
  /**
14464
14797
  * Daemon-asserted runtime state stamped onto a `TaskAttemptSummary` at
14465
14798
  * attempt-completion time. The server persists this block verbatim and
@@ -14485,14 +14818,14 @@ Unsafe(Cyclic({ ClaimCondition: Unsafe(Union([
14485
14818
  op: Literal("all"),
14486
14819
  conditions: _Array_(Ref$2("ClaimCondition"), {
14487
14820
  minItems: 1,
14488
- maxItems: MAX_CLAIM_CONDITION_BRANCHES
14821
+ maxItems: 8
14489
14822
  })
14490
14823
  }, { additionalProperties: false }),
14491
14824
  _Object_({
14492
14825
  op: Literal("any"),
14493
14826
  conditions: _Array_(Ref$2("ClaimCondition"), {
14494
14827
  minItems: 1,
14495
- maxItems: MAX_CLAIM_CONDITION_BRANCHES
14828
+ maxItems: 8
14496
14829
  })
14497
14830
  }, { additionalProperties: false }),
14498
14831
  _Object_({
@@ -14500,7 +14833,7 @@ Unsafe(Cyclic({ ClaimCondition: Unsafe(Union([
14500
14833
  taskId: Uuid,
14501
14834
  statuses: _Array_(Ref$2("TaskStatus"), {
14502
14835
  minItems: 1,
14503
- maxItems: MAX_CLAIM_CONDITION_STATUSES
14836
+ maxItems: 8
14504
14837
  })
14505
14838
  }, { additionalProperties: false }),
14506
14839
  _Object_({
@@ -15962,6 +16295,7 @@ function createAgent(options) {
15962
16295
  problems: createProblemsNamespace(context),
15963
16296
  teams: createTeamsNamespace(context),
15964
16297
  runtimeProfiles: createRuntimeProfilesNamespace(context),
16298
+ runtimePolicies: createRuntimePoliciesNamespace(context),
15965
16299
  tasks: createTasksNamespace(context),
15966
16300
  runtimeSlots: createRuntimeSlotsNamespace(context),
15967
16301
  runtimeSessions: createRuntimeSessionsNamespace(context),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/node-red-contrib-core",
3
- "version": "0.12.5",
3
+ "version": "0.12.7",
4
4
  "type": "module",
5
5
  "description": "Node-RED nodes for the MoltNet API",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "main": "dist/nodes/agent.js",
48
48
  "dependencies": {
49
- "@themoltnet/sdk": "0.125.0"
49
+ "@themoltnet/sdk": "0.127.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^22.19.0",