@themoltnet/pi-extension 0.26.0 → 0.26.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.
Files changed (2) hide show
  1. package/dist/index.js +228 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1792,6 +1792,80 @@ var updateRuntimeProfile = (options) => (options.client ?? client).patch({
1792
1792
  }
1793
1793
  });
1794
1794
  /**
1795
+ * Upsert a team-scoped runtime slot for audit and continuation affinity lookup.
1796
+ */
1797
+ var beginRuntimeSlot = (options) => (options.client ?? client).post({
1798
+ security: [
1799
+ {
1800
+ scheme: "bearer",
1801
+ type: "http"
1802
+ },
1803
+ {
1804
+ name: "X-Moltnet-Session-Token",
1805
+ type: "apiKey"
1806
+ },
1807
+ {
1808
+ in: "cookie",
1809
+ name: "ory_kratos_session",
1810
+ type: "apiKey"
1811
+ }
1812
+ ],
1813
+ url: "/runtime-slots/begin",
1814
+ ...options,
1815
+ headers: {
1816
+ "Content-Type": "application/json",
1817
+ ...options.headers
1818
+ }
1819
+ });
1820
+ /**
1821
+ * Mark a team-scoped runtime slot idle without deleting it.
1822
+ */
1823
+ var finishRuntimeSlot = (options) => (options.client ?? client).post({
1824
+ security: [
1825
+ {
1826
+ scheme: "bearer",
1827
+ type: "http"
1828
+ },
1829
+ {
1830
+ name: "X-Moltnet-Session-Token",
1831
+ type: "apiKey"
1832
+ },
1833
+ {
1834
+ in: "cookie",
1835
+ name: "ory_kratos_session",
1836
+ type: "apiKey"
1837
+ }
1838
+ ],
1839
+ url: "/runtime-slots/finish",
1840
+ ...options,
1841
+ headers: {
1842
+ "Content-Type": "application/json",
1843
+ ...options.headers
1844
+ }
1845
+ });
1846
+ /**
1847
+ * Find the latest team-scoped runtime slot for a task attempt.
1848
+ */
1849
+ var findLatestRuntimeSlotForAttempt = (options) => (options.client ?? client).get({
1850
+ security: [
1851
+ {
1852
+ scheme: "bearer",
1853
+ type: "http"
1854
+ },
1855
+ {
1856
+ name: "X-Moltnet-Session-Token",
1857
+ type: "apiKey"
1858
+ },
1859
+ {
1860
+ in: "cookie",
1861
+ name: "ory_kratos_session",
1862
+ type: "apiKey"
1863
+ }
1864
+ ],
1865
+ url: "/runtime-slots/latest",
1866
+ ...options
1867
+ });
1868
+ /**
1795
1869
  * List tasks for a team with optional filters.
1796
1870
  */
1797
1871
  var listTasks = (options) => (options.client ?? client).get({
@@ -4848,14 +4922,14 @@ function createRuntimeProfilesNamespace(context) {
4848
4922
  return unwrapResult(await listRuntimeProfiles({
4849
4923
  client,
4850
4924
  auth,
4851
- headers: teamHeaders(options)
4925
+ headers: teamHeaders$1(options)
4852
4926
  }));
4853
4927
  },
4854
4928
  async create(body, options) {
4855
4929
  return unwrapResult(await createRuntimeProfile({
4856
4930
  client,
4857
4931
  auth,
4858
- headers: teamHeaders(options),
4932
+ headers: teamHeaders$1(options),
4859
4933
  body
4860
4934
  }));
4861
4935
  },
@@ -4884,10 +4958,49 @@ function createRuntimeProfilesNamespace(context) {
4884
4958
  }
4885
4959
  };
4886
4960
  }
4887
- function teamHeaders(options) {
4961
+ function teamHeaders$1(options) {
4888
4962
  return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
4889
4963
  }
4890
4964
  //#endregion
4965
+ //#region ../sdk/src/namespaces/runtime-slots.ts
4966
+ function createRuntimeSlotsNamespace(context) {
4967
+ const { client, auth } = context;
4968
+ return {
4969
+ async begin(body, options) {
4970
+ return unwrapResult(await beginRuntimeSlot({
4971
+ client,
4972
+ auth,
4973
+ headers: teamHeaders(options),
4974
+ body
4975
+ }));
4976
+ },
4977
+ async finish(body, options) {
4978
+ return unwrapResult(await finishRuntimeSlot({
4979
+ client,
4980
+ auth,
4981
+ headers: teamHeaders(options),
4982
+ body
4983
+ }));
4984
+ },
4985
+ async findLatestForAttempt(query, options) {
4986
+ try {
4987
+ return unwrapResult(await findLatestRuntimeSlotForAttempt({
4988
+ client,
4989
+ auth,
4990
+ headers: teamHeaders(options),
4991
+ query
4992
+ }));
4993
+ } catch (err) {
4994
+ if (err instanceof MoltNetError && err.statusCode === 404) return null;
4995
+ throw err;
4996
+ }
4997
+ }
4998
+ };
4999
+ }
5000
+ function teamHeaders(options) {
5001
+ return { "x-moltnet-team-id": options.teamId };
5002
+ }
5003
+ //#endregion
4891
5004
  //#region ../sdk/src/namespaces/signing-requests.ts
4892
5005
  function createSigningRequestsNamespace(context) {
4893
5006
  const { client, auth } = context;
@@ -5204,6 +5317,7 @@ function createAgent(options) {
5204
5317
  teams: createTeamsNamespace(context),
5205
5318
  runtimeProfiles: createRuntimeProfilesNamespace(context),
5206
5319
  tasks: createTasksNamespace(context),
5320
+ runtimeSlots: createRuntimeSlotsNamespace(context),
5207
5321
  client,
5208
5322
  getToken: () => tokenManager.getToken()
5209
5323
  };
@@ -13692,6 +13806,117 @@ _Object_({
13692
13806
  additionalProperties: false
13693
13807
  });
13694
13808
  //#endregion
13809
+ //#region ../tasks/src/runtime-slots.ts
13810
+ var RuntimeWorkspaceKind = Union([
13811
+ Literal("origin"),
13812
+ Literal("fork"),
13813
+ Literal("scratch")
13814
+ ]);
13815
+ var RuntimeSlotState = Union([Literal("active"), Literal("idle")]);
13816
+ var RuntimeWorkspace = _Object_({
13817
+ id: String$1({ format: "uuid" }),
13818
+ teamId: String$1({ format: "uuid" }),
13819
+ workspaceId: String$1({ minLength: 1 }),
13820
+ worktreePath: String$1({ minLength: 1 }),
13821
+ worktreeBranch: Union([String$1({ minLength: 1 }), Null()]),
13822
+ kind: RuntimeWorkspaceKind,
13823
+ createdAtMs: Integer({ minimum: 0 }),
13824
+ lastUsedAtMs: Integer({ minimum: 0 })
13825
+ }, { $id: "RuntimeWorkspace" });
13826
+ _Object_({
13827
+ slot: _Object_({
13828
+ id: String$1({ format: "uuid" }),
13829
+ teamId: String$1({ format: "uuid" }),
13830
+ agentName: String$1({
13831
+ minLength: 1,
13832
+ maxLength: 100
13833
+ }),
13834
+ daemonProfileId: Union([String$1({ format: "uuid" }), Null()]),
13835
+ provider: String$1({
13836
+ minLength: 1,
13837
+ maxLength: 100
13838
+ }),
13839
+ model: String$1({
13840
+ minLength: 1,
13841
+ maxLength: 200
13842
+ }),
13843
+ slotKey: String$1({ minLength: 1 }),
13844
+ taskType: String$1({
13845
+ minLength: 1,
13846
+ maxLength: 100
13847
+ }),
13848
+ state: RuntimeSlotState,
13849
+ lastTaskId: String$1({ format: "uuid" }),
13850
+ lastAttemptN: Integer({ minimum: 1 }),
13851
+ sessionDir: Union([String$1({ minLength: 1 }), Null()]),
13852
+ sessionPath: Union([String$1({ minLength: 1 }), Null()]),
13853
+ workspaceRowId: Union([String$1({ format: "uuid" }), Null()]),
13854
+ createdAtMs: Integer({ minimum: 0 }),
13855
+ lastUsedAtMs: Integer({ minimum: 0 }),
13856
+ expiresAtMs: Integer({ minimum: 0 })
13857
+ }, { $id: "RuntimeSlot" }),
13858
+ workspace: Union([RuntimeWorkspace, Null()])
13859
+ }, { $id: "ResolvedRuntimeSlot" });
13860
+ _Object_({
13861
+ agentName: String$1({
13862
+ minLength: 1,
13863
+ maxLength: 100
13864
+ }),
13865
+ daemonProfileId: Optional(String$1({ format: "uuid" })),
13866
+ provider: String$1({
13867
+ minLength: 1,
13868
+ maxLength: 100
13869
+ }),
13870
+ model: String$1({
13871
+ minLength: 1,
13872
+ maxLength: 200
13873
+ }),
13874
+ slotKey: String$1({ minLength: 1 }),
13875
+ taskType: String$1({
13876
+ minLength: 1,
13877
+ maxLength: 100
13878
+ }),
13879
+ sessionDir: Optional(String$1({ minLength: 1 })),
13880
+ sessionPath: Optional(String$1({ minLength: 1 })),
13881
+ workspaceId: Optional(String$1({ minLength: 1 })),
13882
+ worktreePath: Optional(String$1({ minLength: 1 })),
13883
+ worktreeBranch: Optional(String$1({ minLength: 1 })),
13884
+ workspaceKind: Optional(RuntimeWorkspaceKind),
13885
+ lastTaskId: String$1({ format: "uuid" }),
13886
+ lastAttemptN: Integer({ minimum: 1 })
13887
+ }, {
13888
+ $id: "BeginRuntimeSlotBody",
13889
+ additionalProperties: false
13890
+ });
13891
+ _Object_({
13892
+ agentName: String$1({
13893
+ minLength: 1,
13894
+ maxLength: 100
13895
+ }),
13896
+ provider: String$1({
13897
+ minLength: 1,
13898
+ maxLength: 100
13899
+ }),
13900
+ model: String$1({
13901
+ minLength: 1,
13902
+ maxLength: 200
13903
+ }),
13904
+ slotKey: String$1({ minLength: 1 }),
13905
+ taskId: String$1({ format: "uuid" }),
13906
+ attemptN: Integer({ minimum: 1 }),
13907
+ sessionPath: Optional(String$1({ minLength: 1 }))
13908
+ }, {
13909
+ $id: "FinishRuntimeSlotBody",
13910
+ additionalProperties: false
13911
+ });
13912
+ _Object_({
13913
+ taskId: String$1({ format: "uuid" }),
13914
+ attemptN: Integer({ minimum: 1 })
13915
+ }, {
13916
+ $id: "FindLatestRuntimeSlotForAttemptQuery",
13917
+ additionalProperties: false
13918
+ });
13919
+ //#endregion
13695
13920
  //#region ../tasks/src/success-criteria.ts
13696
13921
  /**
13697
13922
  * SuccessCriteria — proposer-stated acceptance criteria, evaluated in two
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/pi-extension",
3
- "version": "0.26.0",
3
+ "version": "0.26.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/sdk": "0.108.0",
40
- "@themoltnet/agent-runtime": "0.26.0"
39
+ "@themoltnet/agent-runtime": "0.27.0",
40
+ "@themoltnet/sdk": "0.109.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@earendil-works/pi-coding-agent": ">=0.74.0",