@jigs.design/server 0.1.2 → 0.2.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/README.md CHANGED
@@ -44,7 +44,7 @@ Specs need not come from the model. `jigs.spec(name)` returns a spec your produc
44
44
  | `chatBlockText` | Writes a chat block back as a fenced block, for the model's history |
45
45
  | `@jigs.design/server/node` | `nodeHandler`, for Node's `http` and Express |
46
46
 
47
- It re-exports the shared types from `@jigs.design/runtime`.
47
+ It re-exports the shared types from `@jigs.design/protocol`.
48
48
 
49
49
  ## Source
50
50
 
package/dist/chat.d.ts CHANGED
@@ -2,7 +2,7 @@ import "./design.js";
2
2
  import { ChatBlockSource } from "./types.js";
3
3
  import "./session.js";
4
4
  import "@jigs.design/compiler";
5
- import { ChatBlock, Diagnostic, Program } from "@jigs.design/runtime";
5
+ import { ChatBlock, Diagnostic, Program } from "@jigs.design/protocol";
6
6
  //#region src/chat.d.ts
7
7
  /**
8
8
  * A block as the model wrote it, for the model's history: a fenced `jigs`
package/dist/compile.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import "./design.js";
2
2
  import { Catalog, Host } from "@jigs.design/host";
3
- import { Diagnostic, Program } from "@jigs.design/runtime";
3
+ import { Diagnostic, Program } from "@jigs.design/protocol";
package/dist/compile.js CHANGED
@@ -2,9 +2,9 @@ import { designChecks } from "./design.js";
2
2
  import { JigsCompileError, fatalDiagnostics } from "./errors.js";
3
3
  import { inputDiagnostics } from "./inputs.js";
4
4
  import { outputDiagnostics } from "./outputs.js";
5
- import { columnAt, compileJigs, compileLibrary, lineAt } from "@jigs.design/compiler";
5
+ import { compileJigs, compileLibrary, spanIn } from "@jigs.design/compiler";
6
6
  import { componentSchema } from "@jigs.design/host";
7
- import { PROGRAM_FORMAT } from "@jigs.design/runtime";
7
+ import { PROGRAM_FORMAT } from "@jigs.design/protocol";
8
8
  //#region src/compile.ts
9
9
  /** Elements the parser makes from Markdown; every catalog must be able to draw them. */
10
10
  const MARKDOWN_ELEMENTS = [
@@ -56,19 +56,6 @@ function compileCatalog(catalog) {
56
56
  return out;
57
57
  }
58
58
  const TAG = /<([a-z][A-Za-z0-9]*)/g;
59
- /** The span of `[start, end)` in `source`. */
60
- function rangeIn(source, start, end) {
61
- return {
62
- column: columnAt(source, start),
63
- end,
64
- line: lineAt(source, start),
65
- start
66
- };
67
- }
68
- /** The span of `place` in `source`: its line, and its range and column when it has one. */
69
- function spanIn(source, place) {
70
- return place.start === void 0 || place.end === void 0 ? { line: place.line } : rangeIn(source, place.start, place.end);
71
- }
72
59
  function procedureDiagnostics(host, source, uses) {
73
60
  const diagnostics = [];
74
61
  const report = (use, code, message) => {
@@ -180,22 +167,7 @@ function createChecker(host) {
180
167
  placement
181
168
  }),
182
169
  diagnostics: [
183
- ...result.diagnostics.map((diagnostic) => {
184
- const sent = {
185
- code: diagnostic.code,
186
- message: diagnostic.message,
187
- severity: diagnostic.severity === "warning" ? "error" : "info",
188
- span: spanIn(body, diagnostic)
189
- };
190
- if (diagnostic.fix !== void 0) sent.fix = {
191
- edits: diagnostic.fix.edits.map((edit) => ({
192
- span: rangeIn(body, edit.start, edit.end),
193
- text: edit.text
194
- })),
195
- title: diagnostic.fix.title
196
- };
197
- return sent;
198
- }),
170
+ ...result.diagnostics,
199
171
  ...procedureDiagnostics(host, body, own),
200
172
  ...outputDiagnostics(host, body, result.reads),
201
173
  ...inputDiagnostics(host, body)
package/dist/design.d.ts CHANGED
@@ -1,14 +1,17 @@
1
1
  import "@jigs.design/compiler";
2
2
  import { Catalog } from "@jigs.design/host";
3
- import { Span } from "@jigs.design/runtime";
3
+ import { Span } from "@jigs.design/protocol";
4
4
  //#region src/design.d.ts
5
5
  /** The design checks, by code. */
6
6
  export type DesignCheckCode = "design/literal-braces" | "design/many-actions" | "design/many-primary" | "design/nested-card" | "design/trailing-divider" | "design/unlabelled-button" | "design/unlabelled-chart" | "design/unlabelled-field";
7
- /** A design check's finding: advice, never an error. */
7
+ /**
8
+ * A design check's finding: advice, never a diagnostic. It has no severity,
9
+ * since it never makes a turn invalid; `designRepair` decides whether it
10
+ * gets a repair round.
11
+ */
8
12
  export interface Advice {
9
13
  code: DesignCheckCode;
10
14
  message: string;
11
- severity: "advice";
12
15
  /** The line the advice is about, numbered like the diagnostics beside it. */
13
16
  span: Span;
14
17
  }
package/dist/design.js CHANGED
@@ -28,7 +28,6 @@ function designChecks(options) {
28
28
  advice.push({
29
29
  code,
30
30
  message,
31
- severity: "advice",
32
31
  span: { line }
33
32
  });
34
33
  }
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Diagnostic, JigsErrorCode, JigsErrorData } from "@jigs.design/runtime";
1
+ import { Diagnostic, JigsErrorCode, JigsErrorData } from "@jigs.design/protocol";
2
2
  //#region src/errors.d.ts
3
3
  /** Codes a product may throw from `context` or `run`. */
4
4
  export type ThrownCode = Exclude<JigsErrorCode, "DECLINED" | "NETWORK" | "UNAVAILABLE" | "UNKNOWN_PROCEDURE">;
package/dist/index.d.ts CHANGED
@@ -6,5 +6,5 @@ import { JigsCompileError, JigsError, ThrownCode } from "./errors.js";
6
6
  import { createJigsServer, defineRun } from "./server.js";
7
7
  import { addUsage } from "./usage.js";
8
8
  import { PromptMode } from "@jigs.design/prompt";
9
- import { ChatBlock, ChatBlockStatus, Diagnostic, JigsErrorCode, JigsErrorData, Message, Program, SessionEvent, Span } from "@jigs.design/runtime";
10
- export { type Advice, type CallContext, type CallOutcome, type CallReport, type CallReportOutcome, type CallRequest, type ChatBlock, type ChatBlockResult, type ChatBlockSource, type ChatBlockStatus, type ChatEvent, type ChatOptions, type ChatTurn, type CompileOptions, type ConfirmationStore, type ContextFunction, type DesignCheckCode, type Diagnostic, type EditFailureReason, type ErrorInfo, JigsCompileError, JigsError, type JigsErrorCode, type JigsErrorData, type JigsServer, type JigsServerOptions, type Message, type ModelFunction, type ModelRequest, type ModelRequestKind, type Placement, type PolicyCall, type Program, type PromptMode, type RequiresAction, type RunFunctions, type SessionEvent, type SessionRequest, type Span, type ThrownCode, type Turn, type TurnEdits, type TurnRewrite, type TurnRound, type Usage, addUsage, chatBlockText, createJigsServer, defineRun, memoryConfirmations };
9
+ import { ChatBlock, ChatBlockStatus, Diagnostic, JigsErrorCode, JigsErrorData, Message, Program, SessionEvent, Severity, Span } from "@jigs.design/protocol";
10
+ export { type Advice, type CallContext, type CallOutcome, type CallReport, type CallReportOutcome, type CallRequest, type ChatBlock, type ChatBlockResult, type ChatBlockSource, type ChatBlockStatus, type ChatEvent, type ChatOptions, type ChatTurn, type CompileOptions, type ConfirmationStore, type ContextFunction, type DesignCheckCode, type Diagnostic, type EditFailureReason, type ErrorInfo, JigsCompileError, JigsError, type JigsErrorCode, type JigsErrorData, type JigsServer, type JigsServerOptions, type Message, type ModelFunction, type ModelRequest, type ModelRequestKind, type Placement, type PolicyCall, type Program, type PromptMode, type RequiresAction, type RunFunctions, type SessionEvent, type SessionRequest, type Severity, type Span, type ThrownCode, type Turn, type TurnEdits, type TurnRewrite, type TurnRound, type Usage, addUsage, chatBlockText, createJigsServer, defineRun, memoryConfirmations };
package/dist/outputs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { branches, objectFields } from "./inputs.js";
2
- import { ELEMENT, columnAt, lineAt, nearest } from "@jigs.design/compiler";
2
+ import { ELEMENT, nearest, spanIn } from "@jigs.design/compiler";
3
3
  import { dataSchema } from "@jigs.design/host";
4
4
  import { z } from "zod";
5
5
  //#region src/outputs.ts
@@ -106,12 +106,7 @@ function outputDiagnostics(host, source, reads) {
106
106
  code: "procedure_output",
107
107
  message: `${written} has no field "${name}"${hint}`,
108
108
  severity: "error",
109
- span: place.start === void 0 || place.end === void 0 ? { line: place.line } : {
110
- column: columnAt(source, place.start),
111
- end: place.end,
112
- line: lineAt(source, place.start),
113
- start: place.start
114
- }
109
+ span: spanIn(source, place)
115
110
  });
116
111
  }
117
112
  return diagnostics;
package/dist/server.js CHANGED
@@ -7,7 +7,7 @@ import { confirmMessage, createConfirmer, memoryConfirmations } from "./confirm.
7
7
  import { invalidationsOf } from "./invalidation.js";
8
8
  import { systemPromptParts } from "@jigs.design/prompt";
9
9
  import { isCallPolicy } from "@jigs.design/host";
10
- import { PROGRAM_FORMAT } from "@jigs.design/runtime";
10
+ import { PROGRAM_FORMAT } from "@jigs.design/protocol";
11
11
  import { z } from "zod";
12
12
  import { frameDocument, frameSecurityPolicy } from "@jigs.design/runtime/frame";
13
13
  //#region src/server.ts
package/dist/session.d.ts CHANGED
@@ -3,5 +3,5 @@ import "./compile.js";
3
3
  import "./types.js";
4
4
  import "@jigs.design/compiler";
5
5
  import { Host } from "@jigs.design/host";
6
- import { Diagnostic, Message, SessionEvent } from "@jigs.design/runtime";
6
+ import { Diagnostic, Message, SessionEvent } from "@jigs.design/protocol";
7
7
  import { z } from "zod";
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ import { ConfirmationStore } from "./confirm.js";
3
3
  import { EditFailureReason } from "@jigs.design/compiler";
4
4
  import { PromptMode } from "@jigs.design/prompt";
5
5
  import { ActionDefinition, CallPolicy, Catalog, Host, InputOf, MutationDefinition, OutputOf, ProcedureDefinition, Procedures } from "@jigs.design/host";
6
- import { ChatBlock, ChatBlockStatus, Diagnostic, Invalidation, JigsErrorData, Message, Program, SessionEvent } from "@jigs.design/runtime";
6
+ import { ChatBlock, ChatBlockStatus, Diagnostic, Invalidation, JigsErrorData, Message, Program, SessionEvent } from "@jigs.design/protocol";
7
7
  import { z } from "zod";
8
8
  //#region src/types.d.ts
9
9
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jigs.design/server",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "createJigsServer: checks and streams programs, runs procedures, and serves the sandbox frame.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,10 +29,11 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@jigs.design/host": "0.1.2",
33
- "@jigs.design/prompt": "0.1.2",
34
- "@jigs.design/compiler": "0.1.2",
35
- "@jigs.design/runtime": "0.1.2"
32
+ "@jigs.design/compiler": "0.2.0",
33
+ "@jigs.design/host": "0.2.0",
34
+ "@jigs.design/prompt": "0.2.0",
35
+ "@jigs.design/protocol": "0.2.0",
36
+ "@jigs.design/runtime": "0.2.0"
36
37
  },
37
38
  "peerDependencies": {
38
39
  "zod": "^4.0.0"