@themoltnet/pi-extension 0.26.5 → 0.27.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.
- package/dist/index.js +60 -36
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2831,46 +2831,66 @@ function createCryptoNamespace(context, signingRequests) {
|
|
|
2831
2831
|
};
|
|
2832
2832
|
}
|
|
2833
2833
|
//#endregion
|
|
2834
|
+
//#region ../sdk/src/namespaces/team-headers.ts
|
|
2835
|
+
/**
|
|
2836
|
+
* Build the team header from an optional option, or `undefined` when no team
|
|
2837
|
+
* context was supplied. Used by diaries and runtime-profiles, whose endpoints
|
|
2838
|
+
* accept the header optionally.
|
|
2839
|
+
*/
|
|
2840
|
+
function teamHeaders(options) {
|
|
2841
|
+
return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Build the team header from a required option. Used by tasks and
|
|
2845
|
+
* runtime-slots, whose endpoints mandate the header.
|
|
2846
|
+
*/
|
|
2847
|
+
function requiredTeamHeaders(options) {
|
|
2848
|
+
return { "x-moltnet-team-id": options.teamId };
|
|
2849
|
+
}
|
|
2850
|
+
//#endregion
|
|
2834
2851
|
//#region ../sdk/src/namespaces/diaries.ts
|
|
2835
2852
|
function createDiariesNamespace(context) {
|
|
2836
2853
|
const { client, auth } = context;
|
|
2837
2854
|
return {
|
|
2838
|
-
async list(query,
|
|
2855
|
+
async list(query, options) {
|
|
2839
2856
|
return unwrapResult(await listDiaries({
|
|
2840
2857
|
client,
|
|
2841
2858
|
auth,
|
|
2842
2859
|
query,
|
|
2843
|
-
headers
|
|
2860
|
+
headers: teamHeaders(options)
|
|
2844
2861
|
}));
|
|
2845
2862
|
},
|
|
2846
|
-
async create(body,
|
|
2863
|
+
async create(body, options) {
|
|
2847
2864
|
return unwrapResult(await createDiary({
|
|
2848
2865
|
client,
|
|
2849
2866
|
auth,
|
|
2850
2867
|
body,
|
|
2851
|
-
headers
|
|
2868
|
+
headers: requiredTeamHeaders(options)
|
|
2852
2869
|
}));
|
|
2853
2870
|
},
|
|
2854
|
-
async get(id) {
|
|
2871
|
+
async get(id, options) {
|
|
2855
2872
|
return unwrapResult(await getDiary({
|
|
2856
2873
|
client,
|
|
2857
2874
|
auth,
|
|
2858
|
-
path: { id }
|
|
2875
|
+
path: { id },
|
|
2876
|
+
headers: teamHeaders(options)
|
|
2859
2877
|
}));
|
|
2860
2878
|
},
|
|
2861
|
-
async update(id, body) {
|
|
2879
|
+
async update(id, body, options) {
|
|
2862
2880
|
return unwrapResult(await updateDiary({
|
|
2863
2881
|
client,
|
|
2864
2882
|
auth,
|
|
2865
2883
|
path: { id },
|
|
2866
|
-
body
|
|
2884
|
+
body,
|
|
2885
|
+
headers: teamHeaders(options)
|
|
2867
2886
|
}));
|
|
2868
2887
|
},
|
|
2869
|
-
async delete(id) {
|
|
2888
|
+
async delete(id, options) {
|
|
2870
2889
|
return unwrapResult(await deleteDiary({
|
|
2871
2890
|
client,
|
|
2872
2891
|
auth,
|
|
2873
|
-
path: { id }
|
|
2892
|
+
path: { id },
|
|
2893
|
+
headers: teamHeaders(options)
|
|
2874
2894
|
}));
|
|
2875
2895
|
},
|
|
2876
2896
|
async tags(diaryId, query) {
|
|
@@ -4981,14 +5001,14 @@ function createRuntimeProfilesNamespace(context) {
|
|
|
4981
5001
|
return unwrapResult(await listRuntimeProfiles({
|
|
4982
5002
|
client,
|
|
4983
5003
|
auth,
|
|
4984
|
-
headers: teamHeaders
|
|
5004
|
+
headers: teamHeaders(options)
|
|
4985
5005
|
}));
|
|
4986
5006
|
},
|
|
4987
5007
|
async create(body, options) {
|
|
4988
5008
|
return unwrapResult(await createRuntimeProfile({
|
|
4989
5009
|
client,
|
|
4990
5010
|
auth,
|
|
4991
|
-
headers: teamHeaders
|
|
5011
|
+
headers: teamHeaders(options),
|
|
4992
5012
|
body
|
|
4993
5013
|
}));
|
|
4994
5014
|
},
|
|
@@ -5017,9 +5037,6 @@ function createRuntimeProfilesNamespace(context) {
|
|
|
5017
5037
|
}
|
|
5018
5038
|
};
|
|
5019
5039
|
}
|
|
5020
|
-
function teamHeaders$1(options) {
|
|
5021
|
-
return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
|
|
5022
|
-
}
|
|
5023
5040
|
//#endregion
|
|
5024
5041
|
//#region ../sdk/src/namespaces/runtime-slots.ts
|
|
5025
5042
|
function createRuntimeSlotsNamespace(context) {
|
|
@@ -5029,7 +5046,7 @@ function createRuntimeSlotsNamespace(context) {
|
|
|
5029
5046
|
return unwrapResult(await beginRuntimeSlot({
|
|
5030
5047
|
client,
|
|
5031
5048
|
auth,
|
|
5032
|
-
headers:
|
|
5049
|
+
headers: requiredTeamHeaders(options),
|
|
5033
5050
|
body
|
|
5034
5051
|
}));
|
|
5035
5052
|
},
|
|
@@ -5037,7 +5054,7 @@ function createRuntimeSlotsNamespace(context) {
|
|
|
5037
5054
|
return unwrapResult(await finishRuntimeSlot({
|
|
5038
5055
|
client,
|
|
5039
5056
|
auth,
|
|
5040
|
-
headers:
|
|
5057
|
+
headers: requiredTeamHeaders(options),
|
|
5041
5058
|
body
|
|
5042
5059
|
}));
|
|
5043
5060
|
},
|
|
@@ -5046,7 +5063,7 @@ function createRuntimeSlotsNamespace(context) {
|
|
|
5046
5063
|
return unwrapResult(await findLatestRuntimeSlotForAttempt({
|
|
5047
5064
|
client,
|
|
5048
5065
|
auth,
|
|
5049
|
-
headers:
|
|
5066
|
+
headers: requiredTeamHeaders(options),
|
|
5050
5067
|
query
|
|
5051
5068
|
}));
|
|
5052
5069
|
} catch (err) {
|
|
@@ -5056,9 +5073,6 @@ function createRuntimeSlotsNamespace(context) {
|
|
|
5056
5073
|
}
|
|
5057
5074
|
};
|
|
5058
5075
|
}
|
|
5059
|
-
function teamHeaders(options) {
|
|
5060
|
-
return { "x-moltnet-team-id": options.teamId };
|
|
5061
|
-
}
|
|
5062
5076
|
//#endregion
|
|
5063
5077
|
//#region ../sdk/src/namespaces/signing-requests.ts
|
|
5064
5078
|
function createSigningRequestsNamespace(context) {
|
|
@@ -13782,6 +13796,7 @@ var TaskBuilder = class {
|
|
|
13782
13796
|
inputData;
|
|
13783
13797
|
refs = [];
|
|
13784
13798
|
body = {};
|
|
13799
|
+
teamIdValue;
|
|
13785
13800
|
constructor(taskType, input) {
|
|
13786
13801
|
this.taskType = taskType;
|
|
13787
13802
|
this.inputData = { ...input };
|
|
@@ -13920,7 +13935,7 @@ var TaskBuilder = class {
|
|
|
13920
13935
|
* @returns This builder, for chaining.
|
|
13921
13936
|
*/
|
|
13922
13937
|
team(teamId) {
|
|
13923
|
-
this.
|
|
13938
|
+
this.teamIdValue = teamId;
|
|
13924
13939
|
return this;
|
|
13925
13940
|
}
|
|
13926
13941
|
/**
|
|
@@ -14031,16 +14046,17 @@ var TaskBuilder = class {
|
|
|
14031
14046
|
* generated `correlationId` when omitted, so the persisted top-level body may
|
|
14032
14047
|
* gain that one field.
|
|
14033
14048
|
*
|
|
14034
|
-
* @returns A validated
|
|
14049
|
+
* @returns A {@link BuiltTask}: the validated body plus the team context
|
|
14050
|
+
* (which travels as the `x-moltnet-team-id` header, not the body).
|
|
14035
14051
|
* @throws {TaskBuildError} when required fields are missing or the payload
|
|
14036
14052
|
* fails the shared `@moltnet/tasks` validation, with field-level detail.
|
|
14037
14053
|
* @example
|
|
14038
|
-
* const
|
|
14039
|
-
* await agent.tasks.create(
|
|
14054
|
+
* const built = buildFreeform({ brief }).team(t).diary(d).build();
|
|
14055
|
+
* await agent.tasks.create(built);
|
|
14040
14056
|
*/
|
|
14041
14057
|
build() {
|
|
14042
14058
|
const missing = [];
|
|
14043
|
-
if (!this.
|
|
14059
|
+
if (!this.teamIdValue) missing.push({
|
|
14044
14060
|
field: "teamId",
|
|
14045
14061
|
message: "teamId is required"
|
|
14046
14062
|
});
|
|
@@ -14058,12 +14074,14 @@ var TaskBuilder = class {
|
|
|
14058
14074
|
const all = [...missing, ...validationErrors];
|
|
14059
14075
|
if (all.length > 0) throw new TaskBuildError(all);
|
|
14060
14076
|
return {
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14077
|
+
body: {
|
|
14078
|
+
...this.body,
|
|
14079
|
+
taskType: this.taskType,
|
|
14080
|
+
input: normalizedInput,
|
|
14081
|
+
diaryId: this.body.diaryId,
|
|
14082
|
+
...references ? { references } : {}
|
|
14083
|
+
},
|
|
14084
|
+
teamId: this.teamIdValue
|
|
14067
14085
|
};
|
|
14068
14086
|
}
|
|
14069
14087
|
};
|
|
@@ -14312,18 +14330,24 @@ function createTasksNamespace(context) {
|
|
|
14312
14330
|
auth
|
|
14313
14331
|
}));
|
|
14314
14332
|
},
|
|
14315
|
-
async list(query) {
|
|
14333
|
+
async list(query, options) {
|
|
14316
14334
|
return unwrapResult(await listTasks({
|
|
14317
14335
|
client,
|
|
14318
14336
|
auth,
|
|
14319
|
-
query
|
|
14337
|
+
query,
|
|
14338
|
+
headers: requiredTeamHeaders(options)
|
|
14320
14339
|
}));
|
|
14321
14340
|
},
|
|
14322
|
-
async create(
|
|
14341
|
+
async create(bodyOrBuilt, options) {
|
|
14342
|
+
const { body, teamId } = options !== void 0 ? {
|
|
14343
|
+
body: bodyOrBuilt,
|
|
14344
|
+
teamId: options.teamId
|
|
14345
|
+
} : bodyOrBuilt;
|
|
14323
14346
|
return unwrapResult(await createTask({
|
|
14324
14347
|
client,
|
|
14325
14348
|
auth,
|
|
14326
|
-
body
|
|
14349
|
+
body,
|
|
14350
|
+
headers: requiredTeamHeaders({ teamId })
|
|
14327
14351
|
}));
|
|
14328
14352
|
},
|
|
14329
14353
|
buildTask,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/pi-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MoltNet pi extension — sandboxed tool execution in Gondolin VMs with MoltNet identity and persistent memory",
|
|
6
6
|
"keywords": [
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@earendil-works/gondolin": "^0.9.1",
|
|
37
37
|
"@opentelemetry/api": "^1.9.0",
|
|
38
38
|
"typebox": "^1.2.8",
|
|
39
|
-
"@themoltnet/agent-runtime": "0.
|
|
40
|
-
"@themoltnet/sdk": "0.
|
|
39
|
+
"@themoltnet/agent-runtime": "0.29.0",
|
|
40
|
+
"@themoltnet/sdk": "0.112.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@earendil-works/pi-coding-agent": ">=0.74.0",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"vite": "^8.0.0",
|
|
62
62
|
"vite-plugin-dts": "^4.5.4",
|
|
63
63
|
"vitest": "^3.0.0",
|
|
64
|
-
"@moltnet/
|
|
65
|
-
"@moltnet/
|
|
64
|
+
"@moltnet/crypto-service": "0.1.0",
|
|
65
|
+
"@moltnet/tasks": "0.1.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=22"
|