@qilin-agent/ptc-runtime 3.1.5 → 3.1.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.
package/lib/index.js CHANGED
@@ -141,10 +141,24 @@ const PORTABLE_RESERVED_WORDS = new Set([
141
141
  * Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate
142
142
  * failures resolve in {@link PtcRunResult}; only Service Definition contract misuse rejects. Implementations bridge
143
143
  * structured-cloneable bindings, materialize each declared namespace rejection
144
- * class, treat programs as hostile peers, isolate runs from one another, and
144
+ * class, treat programs as hostile peers, isolate distinct state owners, and
145
145
  * terminate and await in-flight runs during disposal.
146
146
  */
147
147
  var PtcRuntime = class extends Service {
148
+ /** Source evaluation form, independent of whether the provider retains state for an owner. */
149
+ get programFormat() {
150
+ return "function-body";
151
+ }
152
+ /**
153
+ * Release an owner's retained environment and await its execution resources.
154
+ * Stateless providers have no retained resources to release.
155
+ * @param owner - The exact object supplied as the request's state owner.
156
+ * @returns Completion after all owned execution resources have been released.
157
+ * @throws When managed resource cleanup fails.
158
+ */
159
+ release(owner) {
160
+ return Promise.resolve();
161
+ }
148
162
  /** Provider-owned program usage guidance for consumers to present alongside the source language. */
149
163
  get executionInstructions() {
150
164
  return "";
@@ -63,7 +63,7 @@ declare module '@qilin-agent/kylin' {
63
63
  * Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate
64
64
  * failures resolve in {@link PtcRunResult}; only Service Definition contract misuse rejects. Implementations bridge
65
65
  * structured-cloneable bindings, materialize each declared namespace rejection
66
- * class, treat programs as hostile peers, isolate runs from one another, and
66
+ * class, treat programs as hostile peers, isolate distinct state owners, and
67
67
  * terminate and await in-flight runs during disposal.
68
68
  */
69
69
  export declare abstract class PtcRuntime extends Service {
@@ -84,6 +84,16 @@ export declare abstract class PtcRuntime extends Service {
84
84
  * `'process'`, `'container'`.
85
85
  */
86
86
  abstract readonly isolation: string;
87
+ /** Source evaluation form, independent of whether the provider retains state for an owner. */
88
+ get programFormat(): 'function-body' | 'repl';
89
+ /**
90
+ * Release an owner's retained environment and await its execution resources.
91
+ * Stateless providers have no retained resources to release.
92
+ * @param owner - The exact object supplied as the request's state owner.
93
+ * @returns Completion after all owned execution resources have been released.
94
+ * @throws When managed resource cleanup fails.
95
+ */
96
+ release(owner: object): Promise<void>;
87
97
  /** Provider-owned program usage guidance for consumers to present alongside the source language. */
88
98
  get executionInstructions(): string;
89
99
  /** Deployment file-policy mode, or undefined for a provider without confinement support. */
@@ -69,11 +69,18 @@ export interface PtcBindingNamespace {
69
69
  export interface PtcRunRequest {
70
70
  /**
71
71
  * The program source, in the runtime's {@link ../index.ts | language}. It
72
- * runs as the body of an async function: top-level `await` and `return`
73
- * are available, and the completion value becomes
72
+ * follows the provider's programFormat: an async function body supports
73
+ * top-level `await` and `return`; a REPL supports top-level declarations,
74
+ * `await`, and a final expression. The completion value becomes
74
75
  * {@link PtcRunResult.value}.
75
76
  */
76
77
  program: string;
78
+ /**
79
+ * Object-identity owner for optional in-memory state. Omission requests a fresh
80
+ * environment. Consumers must await runtime.release(owner) when the owner ends.
81
+ * Stateless providers ignore this field; retained state is never durable.
82
+ */
83
+ stateOwner?: object;
77
84
  /** Host functions exposed to the program, one global object per namespace. */
78
85
  bindings: PtcBindingNamespace[];
79
86
  /** Working directory in the mounted filesystem and subprocess execution world. */
@@ -137,7 +144,7 @@ export interface PtcRunResult {
137
144
  /** Applied file policy and observed denial, when the provider enforces file policy. */
138
145
  sandbox?: PtcRunSandbox;
139
146
  /**
140
- * The program's completion value (its top-level `return`), when it ran to
147
+ * The program's completion value (a return or final REPL expression), when it ran to
141
148
  * completion and the value crossed the runtime's lossless-JSON boundary.
142
149
  * Invalid or over-limit completions fail the run instead of substituting a
143
150
  * rendered string; a failed or value-less run leaves this absent.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qilin-agent/ptc-runtime",
3
3
  "description": "Abstract PTC execution seam (ctx.ptcRuntime) for the QiLin",
4
- "version": "3.1.5",
4
+ "version": "3.1.7",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -30,11 +30,11 @@
30
30
  ],
31
31
  "license": "MIT",
32
32
  "peerDependencies": {
33
- "@qilin-agent/kylin": "~4.0.3",
34
- "@qilin-agent/sandbox": "3.1.5"
33
+ "@qilin-agent/kylin": "~4.0.5",
34
+ "@qilin-agent/sandbox": "3.1.7"
35
35
  },
36
36
  "devDependencies": {
37
- "@qilin-agent/kylin": "~4.0.3",
38
- "@qilin-agent/sandbox": "3.1.5"
37
+ "@qilin-agent/kylin": "~4.0.5",
38
+ "@qilin-agent/sandbox": "3.1.7"
39
39
  }
40
40
  }