@themoltnet/node-red-contrib-core 0.12.0 → 0.12.2
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/nodes/src.js +236 -36
- package/package.json +2 -2
package/dist/nodes/src.js
CHANGED
|
@@ -620,6 +620,102 @@ var getNetworkInfo = (options) => (options?.client ?? client).get({
|
|
|
620
620
|
...options
|
|
621
621
|
});
|
|
622
622
|
/**
|
|
623
|
+
* List agent API keys bound to the active team. Team credential managers may list every agent.
|
|
624
|
+
*/
|
|
625
|
+
var listAgentKeys = (options) => (options.client ?? client).get({
|
|
626
|
+
security: [
|
|
627
|
+
{
|
|
628
|
+
scheme: "bearer",
|
|
629
|
+
type: "http"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: "X-Moltnet-Session-Token",
|
|
633
|
+
type: "apiKey"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
in: "cookie",
|
|
637
|
+
name: "ory_kratos_session",
|
|
638
|
+
type: "apiKey"
|
|
639
|
+
}
|
|
640
|
+
],
|
|
641
|
+
url: "/agent-keys",
|
|
642
|
+
...options
|
|
643
|
+
});
|
|
644
|
+
/**
|
|
645
|
+
* Issue a secret API key bound to one agent and the active team.
|
|
646
|
+
*/
|
|
647
|
+
var createAgentKey = (options) => (options.client ?? client).post({
|
|
648
|
+
security: [
|
|
649
|
+
{
|
|
650
|
+
scheme: "bearer",
|
|
651
|
+
type: "http"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
name: "X-Moltnet-Session-Token",
|
|
655
|
+
type: "apiKey"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
in: "cookie",
|
|
659
|
+
name: "ory_kratos_session",
|
|
660
|
+
type: "apiKey"
|
|
661
|
+
}
|
|
662
|
+
],
|
|
663
|
+
url: "/agent-keys",
|
|
664
|
+
...options,
|
|
665
|
+
headers: {
|
|
666
|
+
"Content-Type": "application/json",
|
|
667
|
+
...options.headers
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
/**
|
|
671
|
+
* Permanently revoke an agent API key.
|
|
672
|
+
*/
|
|
673
|
+
var revokeAgentKey = (options) => (options.client ?? client).post({
|
|
674
|
+
security: [
|
|
675
|
+
{
|
|
676
|
+
scheme: "bearer",
|
|
677
|
+
type: "http"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: "X-Moltnet-Session-Token",
|
|
681
|
+
type: "apiKey"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
in: "cookie",
|
|
685
|
+
name: "ory_kratos_session",
|
|
686
|
+
type: "apiKey"
|
|
687
|
+
}
|
|
688
|
+
],
|
|
689
|
+
url: "/agent-keys/{keyId}/revoke",
|
|
690
|
+
...options,
|
|
691
|
+
headers: {
|
|
692
|
+
"Content-Type": "application/json",
|
|
693
|
+
...options.headers
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
/**
|
|
697
|
+
* Rotate an agent API key immediately. The previous secret is revoked and expiry is unchanged.
|
|
698
|
+
*/
|
|
699
|
+
var rotateAgentKey = (options) => (options.client ?? client).post({
|
|
700
|
+
security: [
|
|
701
|
+
{
|
|
702
|
+
scheme: "bearer",
|
|
703
|
+
type: "http"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
name: "X-Moltnet-Session-Token",
|
|
707
|
+
type: "apiKey"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
in: "cookie",
|
|
711
|
+
name: "ory_kratos_session",
|
|
712
|
+
type: "apiKey"
|
|
713
|
+
}
|
|
714
|
+
],
|
|
715
|
+
url: "/agent-keys/{keyId}/rotate",
|
|
716
|
+
...options
|
|
717
|
+
});
|
|
718
|
+
/**
|
|
623
719
|
* Get the authenticated agent identity (requires bearer token).
|
|
624
720
|
*/
|
|
625
721
|
var getWhoami = (options) => (options?.client ?? client).get({
|
|
@@ -2903,6 +2999,67 @@ function unwrapRequired(result, message, code) {
|
|
|
2903
2999
|
return result.data;
|
|
2904
3000
|
}
|
|
2905
3001
|
//#endregion
|
|
3002
|
+
//#region ../sdk/src/namespaces/team-headers.ts
|
|
3003
|
+
/**
|
|
3004
|
+
* Build the team header from an optional option, or `undefined` when no team
|
|
3005
|
+
* context was supplied. Used by diaries and runtime-profiles, whose endpoints
|
|
3006
|
+
* accept the header optionally.
|
|
3007
|
+
*/
|
|
3008
|
+
function teamHeaders(options) {
|
|
3009
|
+
return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* Build the team header from a required option. Used by tasks and
|
|
3013
|
+
* runtime-slots, whose endpoints mandate the header.
|
|
3014
|
+
*/
|
|
3015
|
+
function requiredTeamHeaders(options) {
|
|
3016
|
+
return { "x-moltnet-team-id": options.teamId };
|
|
3017
|
+
}
|
|
3018
|
+
//#endregion
|
|
3019
|
+
//#region ../sdk/src/namespaces/agent-keys.ts
|
|
3020
|
+
function createAgentKeysNamespace(context) {
|
|
3021
|
+
const { client, auth } = context;
|
|
3022
|
+
return {
|
|
3023
|
+
async list(query, options) {
|
|
3024
|
+
return unwrapResult(await listAgentKeys({
|
|
3025
|
+
client,
|
|
3026
|
+
auth,
|
|
3027
|
+
headers: requiredTeamHeaders(options),
|
|
3028
|
+
query
|
|
3029
|
+
}));
|
|
3030
|
+
},
|
|
3031
|
+
async create(body, options) {
|
|
3032
|
+
return unwrapResult(await createAgentKey({
|
|
3033
|
+
client,
|
|
3034
|
+
auth,
|
|
3035
|
+
headers: {
|
|
3036
|
+
...requiredTeamHeaders(options),
|
|
3037
|
+
"idempotency-key": options.idempotencyKey
|
|
3038
|
+
},
|
|
3039
|
+
body
|
|
3040
|
+
}));
|
|
3041
|
+
},
|
|
3042
|
+
async rotate(keyId, options) {
|
|
3043
|
+
return unwrapResult(await rotateAgentKey({
|
|
3044
|
+
client,
|
|
3045
|
+
auth,
|
|
3046
|
+
headers: requiredTeamHeaders(options),
|
|
3047
|
+
path: { keyId }
|
|
3048
|
+
}));
|
|
3049
|
+
},
|
|
3050
|
+
async revoke(keyId, body, options) {
|
|
3051
|
+
const result = await revokeAgentKey({
|
|
3052
|
+
client,
|
|
3053
|
+
auth,
|
|
3054
|
+
headers: requiredTeamHeaders(options),
|
|
3055
|
+
path: { keyId },
|
|
3056
|
+
body
|
|
3057
|
+
});
|
|
3058
|
+
if (result.error) unwrapResult(result);
|
|
3059
|
+
}
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3062
|
+
//#endregion
|
|
2906
3063
|
//#region ../sdk/src/namespaces/agents.ts
|
|
2907
3064
|
function createAgentsNamespace(context) {
|
|
2908
3065
|
const { client, auth } = context;
|
|
@@ -2960,23 +3117,6 @@ function createCryptoNamespace(context, signingRequests) {
|
|
|
2960
3117
|
};
|
|
2961
3118
|
}
|
|
2962
3119
|
//#endregion
|
|
2963
|
-
//#region ../sdk/src/namespaces/team-headers.ts
|
|
2964
|
-
/**
|
|
2965
|
-
* Build the team header from an optional option, or `undefined` when no team
|
|
2966
|
-
* context was supplied. Used by diaries and runtime-profiles, whose endpoints
|
|
2967
|
-
* accept the header optionally.
|
|
2968
|
-
*/
|
|
2969
|
-
function teamHeaders(options) {
|
|
2970
|
-
return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
|
|
2971
|
-
}
|
|
2972
|
-
/**
|
|
2973
|
-
* Build the team header from a required option. Used by tasks and
|
|
2974
|
-
* runtime-slots, whose endpoints mandate the header.
|
|
2975
|
-
*/
|
|
2976
|
-
function requiredTeamHeaders(options) {
|
|
2977
|
-
return { "x-moltnet-team-id": options.teamId };
|
|
2978
|
-
}
|
|
2979
|
-
//#endregion
|
|
2980
3120
|
//#region ../sdk/src/namespaces/diaries.ts
|
|
2981
3121
|
function createDiariesNamespace(context) {
|
|
2982
3122
|
const { client, auth } = context;
|
|
@@ -4887,7 +5027,10 @@ function createEntriesNamespace(context) {
|
|
|
4887
5027
|
const signingRequest = unwrapResult(await createSigningRequest({
|
|
4888
5028
|
client,
|
|
4889
5029
|
auth,
|
|
4890
|
-
body: {
|
|
5030
|
+
body: {
|
|
5031
|
+
message: computeContentCid(body.entryType ?? "semantic", body.title ?? null, body.content, body.tags ?? null),
|
|
5032
|
+
verificationMethod: "agent-ed25519"
|
|
5033
|
+
}
|
|
4891
5034
|
}));
|
|
4892
5035
|
const privateKeyBytes = new Uint8Array(Buffer.from(privateKey, "base64"));
|
|
4893
5036
|
const signature = await signAsync(new Uint8Array(Buffer.from(signingRequest.signingInput, "base64")), privateKeyBytes);
|
|
@@ -9406,12 +9549,15 @@ function Evaluate(type, options = {}) {
|
|
|
9406
9549
|
* V1 bindings only; Tier-2 (reference_file, mcp_resource, imported_file,
|
|
9407
9550
|
* tool_response_seed, additional_context_hook) ship in a later slice.
|
|
9408
9551
|
*/
|
|
9409
|
-
var
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
]
|
|
9552
|
+
var CONTEXT_BINDINGS = [
|
|
9553
|
+
"skill",
|
|
9554
|
+
"context_inline",
|
|
9555
|
+
"prompt_prefix",
|
|
9556
|
+
"user_inline"
|
|
9557
|
+
];
|
|
9558
|
+
/** Maximum UTF-16 code units accepted in one ContextRef content field. */
|
|
9559
|
+
var CONTEXT_REF_MAX_CONTENT_LENGTH = 65536;
|
|
9560
|
+
var ContextBinding = Unsafe(Union(CONTEXT_BINDINGS.map((binding) => Literal(binding)), { $id: "ContextBinding" }));
|
|
9415
9561
|
/** Reusable input fragment for any task type. Soft cap at 5 items. */
|
|
9416
9562
|
var TaskContext = _Array_(_Object_({
|
|
9417
9563
|
slug: String$1({
|
|
@@ -9422,7 +9568,7 @@ var TaskContext = _Array_(_Object_({
|
|
|
9422
9568
|
binding: ContextBinding,
|
|
9423
9569
|
content: String$1({
|
|
9424
9570
|
minLength: 1,
|
|
9425
|
-
maxLength:
|
|
9571
|
+
maxLength: CONTEXT_REF_MAX_CONTENT_LENGTH
|
|
9426
9572
|
})
|
|
9427
9573
|
}, {
|
|
9428
9574
|
$id: "ContextRef",
|
|
@@ -10775,6 +10921,27 @@ var JudgeEvalAttemptInput = _Object_({
|
|
|
10775
10921
|
$id: "JudgeEvalAttemptInput",
|
|
10776
10922
|
additionalProperties: false
|
|
10777
10923
|
});
|
|
10924
|
+
/** Agent-authored part of a judge attempt's output. */
|
|
10925
|
+
var JudgeEvalAttemptSubmission = _Object_({
|
|
10926
|
+
targetTaskId: String$1({ format: "uuid" }),
|
|
10927
|
+
targetAttemptN: Integer({ minimum: 1 }),
|
|
10928
|
+
variantLabel: String$1({
|
|
10929
|
+
minLength: 1,
|
|
10930
|
+
maxLength: 64,
|
|
10931
|
+
pattern: "^(?!.* - ).*$"
|
|
10932
|
+
}),
|
|
10933
|
+
scores: _Array_(JudgePackScore, { minItems: 1 }),
|
|
10934
|
+
composite: Number$1({
|
|
10935
|
+
minimum: 0,
|
|
10936
|
+
maximum: 1
|
|
10937
|
+
}),
|
|
10938
|
+
verdict: String$1({ minLength: 1 }),
|
|
10939
|
+
judgeModel: Optional(String$1({ minLength: 1 }))
|
|
10940
|
+
}, {
|
|
10941
|
+
$id: "JudgeEvalAttemptSubmission",
|
|
10942
|
+
additionalProperties: false
|
|
10943
|
+
});
|
|
10944
|
+
/** Durable output after the executor stamps the claim trace context. */
|
|
10778
10945
|
var JudgeEvalAttemptOutput = _Object_({
|
|
10779
10946
|
targetTaskId: String$1({ format: "uuid" }),
|
|
10780
10947
|
targetAttemptN: Integer({ minimum: 1 }),
|
|
@@ -10790,7 +10957,7 @@ var JudgeEvalAttemptOutput = _Object_({
|
|
|
10790
10957
|
}),
|
|
10791
10958
|
verdict: String$1({ minLength: 1 }),
|
|
10792
10959
|
judgeModel: Optional(String$1({ minLength: 1 })),
|
|
10793
|
-
traceparent: String$1({ minLength: 1 })
|
|
10960
|
+
traceparent: Optional(String$1({ minLength: 1 }))
|
|
10794
10961
|
}, {
|
|
10795
10962
|
$id: "JudgeEvalAttemptOutput",
|
|
10796
10963
|
additionalProperties: false
|
|
@@ -11082,15 +11249,33 @@ var RunEvalInput = _Object_({
|
|
|
11082
11249
|
$id: "RunEvalInput",
|
|
11083
11250
|
additionalProperties: false
|
|
11084
11251
|
});
|
|
11252
|
+
var RunEvalArtifact = _Object_({
|
|
11253
|
+
path: String$1({ minLength: 1 }),
|
|
11254
|
+
cid: String$1({ minLength: 1 })
|
|
11255
|
+
}, { additionalProperties: false });
|
|
11256
|
+
/**
|
|
11257
|
+
* Fields the eval agent authors through its submit-output tool. Runtime
|
|
11258
|
+
* telemetry deliberately does not live here: an agent cannot truthfully
|
|
11259
|
+
* measure provider token usage, wall-clock duration, or the claim trace.
|
|
11260
|
+
*/
|
|
11261
|
+
var RunEvalSubmission = _Object_({
|
|
11262
|
+
response: String$1({ minLength: 1 }),
|
|
11263
|
+
artifacts: Optional(_Array_(RunEvalArtifact)),
|
|
11264
|
+
verification: Optional(VerificationRecord)
|
|
11265
|
+
}, {
|
|
11266
|
+
$id: "RunEvalSubmission",
|
|
11267
|
+
additionalProperties: false
|
|
11268
|
+
});
|
|
11269
|
+
/**
|
|
11270
|
+
* Durable eval output. The daemon materializes this from RunEvalSubmission
|
|
11271
|
+
* and observed execution metadata before the task service accepts it.
|
|
11272
|
+
*/
|
|
11085
11273
|
var RunEvalOutput = _Object_({
|
|
11086
11274
|
response: String$1({ minLength: 1 }),
|
|
11087
|
-
artifacts: Optional(_Array_(
|
|
11088
|
-
path: String$1({ minLength: 1 }),
|
|
11089
|
-
cid: String$1({ minLength: 1 })
|
|
11090
|
-
}, { additionalProperties: false }))),
|
|
11275
|
+
artifacts: Optional(_Array_(RunEvalArtifact)),
|
|
11091
11276
|
totalTokens: Integer({ minimum: 0 }),
|
|
11092
11277
|
durationMs: Integer({ minimum: 0 }),
|
|
11093
|
-
traceparent: String$1({ minLength: 1 }),
|
|
11278
|
+
traceparent: Optional(String$1({ minLength: 1 })),
|
|
11094
11279
|
verification: Optional(VerificationRecord)
|
|
11095
11280
|
}, {
|
|
11096
11281
|
$id: "RunEvalOutput",
|
|
@@ -11235,6 +11420,7 @@ var BUILT_IN_TASK_TYPES = {
|
|
|
11235
11420
|
name: RUN_EVAL_TYPE,
|
|
11236
11421
|
inputSchema: RunEvalInput,
|
|
11237
11422
|
outputSchema: RunEvalOutput,
|
|
11423
|
+
submissionSchema: RunEvalSubmission,
|
|
11238
11424
|
outputKind: "artifact",
|
|
11239
11425
|
resumable: true,
|
|
11240
11426
|
workspaceScope: "session",
|
|
@@ -11247,6 +11433,7 @@ var BUILT_IN_TASK_TYPES = {
|
|
|
11247
11433
|
name: JUDGE_EVAL_ATTEMPT_TYPE,
|
|
11248
11434
|
inputSchema: JudgeEvalAttemptInput,
|
|
11249
11435
|
outputSchema: JudgeEvalAttemptOutput,
|
|
11436
|
+
submissionSchema: JudgeEvalAttemptSubmission,
|
|
11250
11437
|
outputKind: "judgment",
|
|
11251
11438
|
workspaceScope: "attempt",
|
|
11252
11439
|
sessionScope: "none",
|
|
@@ -13823,22 +14010,33 @@ function validateTaskInput(taskType, input) {
|
|
|
13823
14010
|
}
|
|
13824
14011
|
return [];
|
|
13825
14012
|
}
|
|
13826
|
-
function
|
|
14013
|
+
function checkVerificationInputCid(value, runtime) {
|
|
14014
|
+
const verification = value !== null && typeof value === "object" ? value.verification : void 0;
|
|
14015
|
+
if (runtime?.inputCid && verification !== void 0 && verification.inputCid !== runtime.inputCid) return [{
|
|
14016
|
+
field: "output/verification/inputCid",
|
|
14017
|
+
message: "must match the task input CID"
|
|
14018
|
+
}];
|
|
14019
|
+
return [];
|
|
14020
|
+
}
|
|
14021
|
+
function validateTaskResult(taskType, value, input, runtime, submission = false) {
|
|
13827
14022
|
const entry = getTaskTypeEntry(taskType);
|
|
13828
14023
|
if (!entry) return [{
|
|
13829
14024
|
field: "taskType",
|
|
13830
14025
|
message: `Unknown task type: ${taskType}`
|
|
13831
14026
|
}];
|
|
13832
|
-
const errors = schemaErrors("output", entry.outputSchema,
|
|
14027
|
+
const errors = schemaErrors("output", submission ? entry.submissionSchema ?? entry.outputSchema : entry.outputSchema, value);
|
|
13833
14028
|
if (errors.length > 0) return errors;
|
|
13834
14029
|
if (entry.validateOutput) {
|
|
13835
|
-
const validationError = entry.validateOutput(
|
|
14030
|
+
const validationError = entry.validateOutput(value, input);
|
|
13836
14031
|
if (validationError) return [{
|
|
13837
14032
|
field: "output",
|
|
13838
14033
|
message: validationError
|
|
13839
14034
|
}];
|
|
13840
14035
|
}
|
|
13841
|
-
return
|
|
14036
|
+
return checkVerificationInputCid(value, runtime);
|
|
14037
|
+
}
|
|
14038
|
+
function validateTaskOutput(taskType, output, input, runtime) {
|
|
14039
|
+
return validateTaskResult(taskType, output, input, runtime);
|
|
13842
14040
|
}
|
|
13843
14041
|
/**
|
|
13844
14042
|
* Resolve the TypeBox output schema registered for `taskType`. Returns
|
|
@@ -15443,8 +15641,10 @@ function createAgent(options) {
|
|
|
15443
15641
|
client,
|
|
15444
15642
|
auth
|
|
15445
15643
|
};
|
|
15644
|
+
const diaries = createDiariesNamespace(context);
|
|
15446
15645
|
return {
|
|
15447
|
-
|
|
15646
|
+
agentKeys: createAgentKeysNamespace(context),
|
|
15647
|
+
diaries,
|
|
15448
15648
|
diaryGrants: createDiaryGrantsNamespace(context),
|
|
15449
15649
|
diaryTransfers: createDiaryTransfersNamespace(context),
|
|
15450
15650
|
packs: createPacksNamespace(context),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/node-red-contrib-core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
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.
|
|
49
|
+
"@themoltnet/sdk": "0.122.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^22.19.0",
|