@themoltnet/pi-extension 0.35.0 → 0.35.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.
- package/dist/index.js +174 -29
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -658,6 +658,102 @@ var getNetworkInfo = (options) => (options?.client ?? client).get({
|
|
|
658
658
|
...options
|
|
659
659
|
});
|
|
660
660
|
/**
|
|
661
|
+
* List agent API keys bound to the active team. Team credential managers may list every agent.
|
|
662
|
+
*/
|
|
663
|
+
var listAgentKeys = (options) => (options.client ?? client).get({
|
|
664
|
+
security: [
|
|
665
|
+
{
|
|
666
|
+
scheme: "bearer",
|
|
667
|
+
type: "http"
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
name: "X-Moltnet-Session-Token",
|
|
671
|
+
type: "apiKey"
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
in: "cookie",
|
|
675
|
+
name: "ory_kratos_session",
|
|
676
|
+
type: "apiKey"
|
|
677
|
+
}
|
|
678
|
+
],
|
|
679
|
+
url: "/agent-keys",
|
|
680
|
+
...options
|
|
681
|
+
});
|
|
682
|
+
/**
|
|
683
|
+
* Issue a secret API key bound to one agent and the active team.
|
|
684
|
+
*/
|
|
685
|
+
var createAgentKey = (options) => (options.client ?? client).post({
|
|
686
|
+
security: [
|
|
687
|
+
{
|
|
688
|
+
scheme: "bearer",
|
|
689
|
+
type: "http"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
name: "X-Moltnet-Session-Token",
|
|
693
|
+
type: "apiKey"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
in: "cookie",
|
|
697
|
+
name: "ory_kratos_session",
|
|
698
|
+
type: "apiKey"
|
|
699
|
+
}
|
|
700
|
+
],
|
|
701
|
+
url: "/agent-keys",
|
|
702
|
+
...options,
|
|
703
|
+
headers: {
|
|
704
|
+
"Content-Type": "application/json",
|
|
705
|
+
...options.headers
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
/**
|
|
709
|
+
* Permanently revoke an agent API key.
|
|
710
|
+
*/
|
|
711
|
+
var revokeAgentKey = (options) => (options.client ?? client).post({
|
|
712
|
+
security: [
|
|
713
|
+
{
|
|
714
|
+
scheme: "bearer",
|
|
715
|
+
type: "http"
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
name: "X-Moltnet-Session-Token",
|
|
719
|
+
type: "apiKey"
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
in: "cookie",
|
|
723
|
+
name: "ory_kratos_session",
|
|
724
|
+
type: "apiKey"
|
|
725
|
+
}
|
|
726
|
+
],
|
|
727
|
+
url: "/agent-keys/{keyId}/revoke",
|
|
728
|
+
...options,
|
|
729
|
+
headers: {
|
|
730
|
+
"Content-Type": "application/json",
|
|
731
|
+
...options.headers
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
/**
|
|
735
|
+
* Rotate an agent API key immediately. The previous secret is revoked and expiry is unchanged.
|
|
736
|
+
*/
|
|
737
|
+
var rotateAgentKey = (options) => (options.client ?? client).post({
|
|
738
|
+
security: [
|
|
739
|
+
{
|
|
740
|
+
scheme: "bearer",
|
|
741
|
+
type: "http"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
name: "X-Moltnet-Session-Token",
|
|
745
|
+
type: "apiKey"
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
in: "cookie",
|
|
749
|
+
name: "ory_kratos_session",
|
|
750
|
+
type: "apiKey"
|
|
751
|
+
}
|
|
752
|
+
],
|
|
753
|
+
url: "/agent-keys/{keyId}/rotate",
|
|
754
|
+
...options
|
|
755
|
+
});
|
|
756
|
+
/**
|
|
661
757
|
* Get the authenticated agent identity (requires bearer token).
|
|
662
758
|
*/
|
|
663
759
|
var getWhoami = (options) => (options?.client ?? client).get({
|
|
@@ -2941,6 +3037,67 @@ function unwrapRequired(result, message, code) {
|
|
|
2941
3037
|
return result.data;
|
|
2942
3038
|
}
|
|
2943
3039
|
//#endregion
|
|
3040
|
+
//#region ../sdk/src/namespaces/team-headers.ts
|
|
3041
|
+
/**
|
|
3042
|
+
* Build the team header from an optional option, or `undefined` when no team
|
|
3043
|
+
* context was supplied. Used by diaries and runtime-profiles, whose endpoints
|
|
3044
|
+
* accept the header optionally.
|
|
3045
|
+
*/
|
|
3046
|
+
function teamHeaders(options) {
|
|
3047
|
+
return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
|
|
3048
|
+
}
|
|
3049
|
+
/**
|
|
3050
|
+
* Build the team header from a required option. Used by tasks and
|
|
3051
|
+
* runtime-slots, whose endpoints mandate the header.
|
|
3052
|
+
*/
|
|
3053
|
+
function requiredTeamHeaders(options) {
|
|
3054
|
+
return { "x-moltnet-team-id": options.teamId };
|
|
3055
|
+
}
|
|
3056
|
+
//#endregion
|
|
3057
|
+
//#region ../sdk/src/namespaces/agent-keys.ts
|
|
3058
|
+
function createAgentKeysNamespace(context) {
|
|
3059
|
+
const { client, auth } = context;
|
|
3060
|
+
return {
|
|
3061
|
+
async list(query, options) {
|
|
3062
|
+
return unwrapResult(await listAgentKeys({
|
|
3063
|
+
client,
|
|
3064
|
+
auth,
|
|
3065
|
+
headers: requiredTeamHeaders(options),
|
|
3066
|
+
query
|
|
3067
|
+
}));
|
|
3068
|
+
},
|
|
3069
|
+
async create(body, options) {
|
|
3070
|
+
return unwrapResult(await createAgentKey({
|
|
3071
|
+
client,
|
|
3072
|
+
auth,
|
|
3073
|
+
headers: {
|
|
3074
|
+
...requiredTeamHeaders(options),
|
|
3075
|
+
"idempotency-key": options.idempotencyKey
|
|
3076
|
+
},
|
|
3077
|
+
body
|
|
3078
|
+
}));
|
|
3079
|
+
},
|
|
3080
|
+
async rotate(keyId, options) {
|
|
3081
|
+
return unwrapResult(await rotateAgentKey({
|
|
3082
|
+
client,
|
|
3083
|
+
auth,
|
|
3084
|
+
headers: requiredTeamHeaders(options),
|
|
3085
|
+
path: { keyId }
|
|
3086
|
+
}));
|
|
3087
|
+
},
|
|
3088
|
+
async revoke(keyId, body, options) {
|
|
3089
|
+
const result = await revokeAgentKey({
|
|
3090
|
+
client,
|
|
3091
|
+
auth,
|
|
3092
|
+
headers: requiredTeamHeaders(options),
|
|
3093
|
+
path: { keyId },
|
|
3094
|
+
body
|
|
3095
|
+
});
|
|
3096
|
+
if (result.error) unwrapResult(result);
|
|
3097
|
+
}
|
|
3098
|
+
};
|
|
3099
|
+
}
|
|
3100
|
+
//#endregion
|
|
2944
3101
|
//#region ../sdk/src/namespaces/agents.ts
|
|
2945
3102
|
function createAgentsNamespace(context) {
|
|
2946
3103
|
const { client, auth } = context;
|
|
@@ -2998,23 +3155,6 @@ function createCryptoNamespace(context, signingRequests) {
|
|
|
2998
3155
|
};
|
|
2999
3156
|
}
|
|
3000
3157
|
//#endregion
|
|
3001
|
-
//#region ../sdk/src/namespaces/team-headers.ts
|
|
3002
|
-
/**
|
|
3003
|
-
* Build the team header from an optional option, or `undefined` when no team
|
|
3004
|
-
* context was supplied. Used by diaries and runtime-profiles, whose endpoints
|
|
3005
|
-
* accept the header optionally.
|
|
3006
|
-
*/
|
|
3007
|
-
function teamHeaders(options) {
|
|
3008
|
-
return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
|
|
3009
|
-
}
|
|
3010
|
-
/**
|
|
3011
|
-
* Build the team header from a required option. Used by tasks and
|
|
3012
|
-
* runtime-slots, whose endpoints mandate the header.
|
|
3013
|
-
*/
|
|
3014
|
-
function requiredTeamHeaders(options) {
|
|
3015
|
-
return { "x-moltnet-team-id": options.teamId };
|
|
3016
|
-
}
|
|
3017
|
-
//#endregion
|
|
3018
3158
|
//#region ../sdk/src/namespaces/diaries.ts
|
|
3019
3159
|
function createDiariesNamespace(context) {
|
|
3020
3160
|
const { client, auth } = context;
|
|
@@ -4925,7 +5065,10 @@ function createEntriesNamespace(context) {
|
|
|
4925
5065
|
const signingRequest = unwrapResult(await createSigningRequest({
|
|
4926
5066
|
client,
|
|
4927
5067
|
auth,
|
|
4928
|
-
body: {
|
|
5068
|
+
body: {
|
|
5069
|
+
message: computeContentCid(body.entryType ?? "semantic", body.title ?? null, body.content, body.tags ?? null),
|
|
5070
|
+
verificationMethod: "agent-ed25519"
|
|
5071
|
+
}
|
|
4929
5072
|
}));
|
|
4930
5073
|
const privateKeyBytes = new Uint8Array(Buffer.from(privateKey, "base64"));
|
|
4931
5074
|
const signature = await signAsync(new Uint8Array(Buffer.from(signingRequest.signingInput, "base64")), privateKeyBytes);
|
|
@@ -15585,8 +15728,10 @@ function createAgent(options) {
|
|
|
15585
15728
|
client,
|
|
15586
15729
|
auth
|
|
15587
15730
|
};
|
|
15731
|
+
const diaries = createDiariesNamespace(context);
|
|
15588
15732
|
return {
|
|
15589
|
-
|
|
15733
|
+
agentKeys: createAgentKeysNamespace(context),
|
|
15734
|
+
diaries,
|
|
15590
15735
|
diaryGrants: createDiaryGrantsNamespace(context),
|
|
15591
15736
|
diaryTransfers: createDiaryTransfersNamespace(context),
|
|
15592
15737
|
packs: createPacksNamespace(context),
|
|
@@ -26456,20 +26601,20 @@ async function openVmWorkspaceFileForRead(config) {
|
|
|
26456
26601
|
};
|
|
26457
26602
|
}
|
|
26458
26603
|
function createGondolinToolDefinitions(config) {
|
|
26459
|
-
const { vm,
|
|
26460
|
-
const grepTool = createGrepToolDefinition(
|
|
26604
|
+
const { vm, cwdPath, guestWorkspace } = config;
|
|
26605
|
+
const grepTool = createGrepToolDefinition(cwdPath);
|
|
26461
26606
|
return [
|
|
26462
|
-
createReadToolDefinition(
|
|
26463
|
-
createWriteToolDefinition(
|
|
26464
|
-
createEditToolDefinition(
|
|
26465
|
-
createBashToolDefinition(
|
|
26466
|
-
createLsToolDefinition(
|
|
26467
|
-
createFindToolDefinition(
|
|
26607
|
+
createReadToolDefinition(cwdPath, { operations: createGondolinReadOps(vm, cwdPath, guestWorkspace) }),
|
|
26608
|
+
createWriteToolDefinition(cwdPath, { operations: createGondolinWriteOps(vm, cwdPath, guestWorkspace) }),
|
|
26609
|
+
createEditToolDefinition(cwdPath, { operations: createGondolinEditOps(vm, cwdPath, guestWorkspace) }),
|
|
26610
|
+
createBashToolDefinition(cwdPath, { operations: createGondolinBashOps(vm, cwdPath, guestWorkspace) }),
|
|
26611
|
+
createLsToolDefinition(cwdPath, { operations: createGondolinLsOps(vm, cwdPath, guestWorkspace) }),
|
|
26612
|
+
createFindToolDefinition(cwdPath, { operations: createGondolinFindOps(vm, cwdPath, guestWorkspace) }),
|
|
26468
26613
|
{
|
|
26469
26614
|
...grepTool,
|
|
26470
26615
|
async execute(...args) {
|
|
26471
26616
|
const [_id, params, signal] = args;
|
|
26472
|
-
return executeGondolinGrep(vm,
|
|
26617
|
+
return executeGondolinGrep(vm, cwdPath, guestWorkspace, params, signal);
|
|
26473
26618
|
}
|
|
26474
26619
|
}
|
|
26475
26620
|
];
|
|
@@ -26759,7 +26904,7 @@ async function executePiTask(claimedTask, reporter, opts) {
|
|
|
26759
26904
|
if (injectedContext.userInlineSuffix) taskPrompt = `${taskPrompt}\n\n---\n\n${injectedContext.userInlineSuffix}`;
|
|
26760
26905
|
const gondolinCustomTools = createGondolinToolDefinitions({
|
|
26761
26906
|
vm: managed.vm,
|
|
26762
|
-
|
|
26907
|
+
cwdPath,
|
|
26763
26908
|
guestWorkspace: managed.guestWorkspace
|
|
26764
26909
|
});
|
|
26765
26910
|
const { handle: submitToolHandle, tools: submitToolDefs } = resolveSubmitTools(task.taskType, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/pi-extension",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.1",
|
|
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/
|
|
40
|
-
"@themoltnet/
|
|
39
|
+
"@themoltnet/agent-runtime": "0.36.1",
|
|
40
|
+
"@themoltnet/sdk": "0.122.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@earendil-works/pi-coding-agent": ">=0.74.0",
|