@jigs.design/protocol 0.3.1 → 0.3.3

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/parse.d.ts CHANGED
@@ -4,7 +4,6 @@ export declare function parseErrorData(value: unknown): JigsErrorData | null;
4
4
  /** The `invalidate` list of a mutation's reply. */
5
5
  export declare function parseInvalidations(value: unknown): ReadonlyArray<Invalidation> | null;
6
6
  export declare function parseProgram(value: unknown): Program | null;
7
- /** A page request's reply body, or null when it is not one. */
8
7
  export declare function parsePageReply(value: unknown): PageReply | null;
9
8
  /** One session event from its JSON text, or null when it is not one. */
10
9
  export declare function parseSessionEvent(text: string): SessionEvent | null;
package/dist/parse.js CHANGED
@@ -133,11 +133,19 @@ function parseDiagnostics(value) {
133
133
  });
134
134
  }
135
135
  /** A page request's reply body, or null when it is not one. */
136
+ /** A page's provided data: a record, as the server sends it; missing reads as empty. */
137
+ function parsePageData(value) {
138
+ if (value === void 0) return {};
139
+ if (!isRecord(value)) return null;
140
+ return value;
141
+ }
136
142
  function parsePageReply(value) {
137
143
  if (!isRecord(value) || !isString(value.version)) return null;
138
144
  const program = parseProgram(value.program);
139
145
  const diagnostics = parseDiagnostics(value.diagnostics);
140
- return program === null || diagnostics === null ? null : {
146
+ const data = parsePageData(value.data);
147
+ return program === null || diagnostics === null || data === null ? null : {
148
+ data,
141
149
  diagnostics,
142
150
  program,
143
151
  version: value.version
package/dist/types.d.ts CHANGED
@@ -157,10 +157,16 @@ export interface PageInvalidation<TName extends string = string> {
157
157
  /**
158
158
  * The answer to a page request, `POST { type: "page", name, props }`: the
159
159
  * page's program, its diagnostics (a saved page is compiled leniently, so
160
- * they may hold errors), and the server's `jigs-version`, so a client can
161
- * drop programs an older server compiled.
160
+ * they may hold errors), the provided data the page keeps, and the server's
161
+ * `jigs-version`, so a client can drop programs an older server compiled.
162
162
  */
163
163
  export interface PageReply {
164
+ /**
165
+ * Provided data the page is drawn with, by slot: what `resolvePage` kept
166
+ * with a saved page. Empty for a shipped page. A server before 0.3.3
167
+ * sends none, which the client reads as empty.
168
+ */
169
+ data: Readonly<Record<string, JsonValue>>;
164
170
  diagnostics: ReadonlyArray<Diagnostic>;
165
171
  program: Program;
166
172
  version: string;
@@ -196,6 +202,13 @@ export interface ChatBlock {
196
202
  /** The checked source, with its pragma. Store this, not the program. */
197
203
  source: string;
198
204
  status: ChatBlockStatus;
205
+ /**
206
+ * Set when the block reads the `toolResults` slot (a server with
207
+ * `toolResults: true`): the tool names it reads, or `"all"` when it uses
208
+ * the results whole. `toolData` passes the block only these. Derived from
209
+ * the source on every compile, never trusted for more than trimming.
210
+ */
211
+ toolKeys?: ReadonlyArray<string> | "all";
199
212
  /** 1 for the first block with this name in the conversation, then 2, 3… */
200
213
  version: number;
201
214
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jigs.design/protocol",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "The program format, the diagnostics, and the types and messages the server, the browser and the sandbox share. No runtime and no dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {