codeassembly-agent-logic 0.0.0 → 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/.meta/changelog.json +105 -0
- package/CHANGELOG.md +38 -0
- package/LICENSE +7 -0
- package/README.md +77 -1
- package/bin/agent-logic.js +26 -0
- package/dist/esm/cli/check-coverage-command.d.ts +3 -0
- package/dist/esm/cli/check-coverage-command.js +99 -0
- package/dist/esm/cli/convert-command.d.ts +3 -0
- package/dist/esm/cli/convert-command.js +116 -0
- package/dist/esm/cli/find-package-root.d.ts +7 -0
- package/dist/esm/cli/find-package-root.js +31 -0
- package/dist/esm/cli/index.d.ts +1 -0
- package/dist/esm/cli/index.js +11 -0
- package/dist/esm/cli/run.d.ts +8 -0
- package/dist/esm/cli/run.js +62 -0
- package/dist/esm/contract/built-in-harnesses.d.ts +22 -0
- package/dist/esm/contract/built-in-harnesses.js +30 -0
- package/dist/esm/contract/conversion-job.d.ts +36 -0
- package/dist/esm/contract/conversion-job.js +17 -0
- package/dist/esm/contract/index.d.ts +4 -0
- package/dist/esm/contract/index.js +3 -0
- package/dist/esm/contract/viewer-contract.d.ts +804 -0
- package/dist/esm/contract/viewer-contract.js +38 -0
- package/dist/esm/convert/convert-prompt.d.ts +21 -0
- package/dist/esm/convert/convert-prompt.js +60 -0
- package/dist/esm/convert/draft-schema.d.ts +308 -0
- package/dist/esm/convert/draft-schema.js +57 -0
- package/dist/esm/convert/find-gate-spans.d.ts +6 -0
- package/dist/esm/convert/find-gate-spans.js +18 -0
- package/dist/esm/convert/format-state-name.d.ts +6 -0
- package/dist/esm/convert/format-state-name.js +6 -0
- package/dist/esm/convert/normalize-config.d.ts +11 -0
- package/dist/esm/convert/normalize-config.js +164 -0
- package/dist/esm/convert/resolve-quotes.d.ts +18 -0
- package/dist/esm/convert/resolve-quotes.js +169 -0
- package/dist/esm/convert/sanitize-name.d.ts +5 -0
- package/dist/esm/convert/sanitize-name.js +8 -0
- package/dist/esm/coverage-map/check-coverage.d.ts +20 -0
- package/dist/esm/coverage-map/check-coverage.js +21 -0
- package/dist/esm/coverage-map/coverage-map-schema.d.ts +11 -0
- package/dist/esm/coverage-map/coverage-map-schema.js +2 -0
- package/dist/esm/coverage-map/find-prompt-blocks.d.ts +15 -0
- package/dist/esm/coverage-map/find-prompt-blocks.js +140 -0
- package/dist/esm/examples/change-approval.d.ts +2 -0
- package/dist/esm/examples/change-approval.js +438 -0
- package/dist/esm/examples/examples.d.ts +9 -0
- package/dist/esm/examples/examples.js +8 -0
- package/dist/esm/examples/password-reset.d.ts +2 -0
- package/dist/esm/examples/password-reset.js +235 -0
- package/dist/esm/examples/refund-request.d.ts +2 -0
- package/dist/esm/examples/refund-request.js +233 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/layout/build-elk-graph.d.ts +18 -0
- package/dist/esm/layout/build-elk-graph.js +96 -0
- package/dist/esm/layout/card-limits.d.ts +8 -0
- package/dist/esm/layout/card-limits.js +4 -0
- package/dist/esm/layout/describe-config.d.ts +118 -0
- package/dist/esm/layout/describe-config.js +199 -0
- package/dist/esm/layout/layout-config.d.ts +5 -0
- package/dist/esm/layout/layout-config.js +73 -0
- package/dist/esm/layout/layout-metrics.d.ts +6 -0
- package/dist/esm/layout/layout-metrics.js +6 -0
- package/dist/esm/layout/pack-preamble.d.ts +20 -0
- package/dist/esm/layout/pack-preamble.js +66 -0
- package/dist/esm/layout/to-flow-elements.d.ts +46 -0
- package/dist/esm/layout/to-flow-elements.js +83 -0
- package/dist/esm/react/canvas/AmbientSelectionContext.d.ts +7 -0
- package/dist/esm/react/canvas/AmbientSelectionContext.js +5 -0
- package/dist/esm/react/canvas/DetailLevelContext.d.ts +3 -0
- package/dist/esm/react/canvas/DetailLevelContext.js +2 -0
- package/dist/esm/react/canvas/FocusNavigation.d.ts +8 -0
- package/dist/esm/react/canvas/FocusNavigation.js +92 -0
- package/dist/esm/react/canvas/StateNode.d.ts +5 -0
- package/dist/esm/react/canvas/StateNode.js +91 -0
- package/dist/esm/react/canvas/StatechartCanvas.d.ts +16 -0
- package/dist/esm/react/canvas/StatechartCanvas.js +184 -0
- package/dist/esm/react/canvas/TransitionEdge.d.ts +5 -0
- package/dist/esm/react/canvas/TransitionEdge.js +22 -0
- package/dist/esm/react/canvas/canvas-key-entries.d.ts +14 -0
- package/dist/esm/react/canvas/canvas-key-entries.js +51 -0
- package/dist/esm/react/canvas/find-element-box.d.ts +8 -0
- package/dist/esm/react/canvas/find-element-box.js +25 -0
- package/dist/esm/react/canvas/find-view-centre.d.ts +15 -0
- package/dist/esm/react/canvas/find-view-centre.js +16 -0
- package/dist/esm/react/canvas/list-chart-marks.d.ts +5 -0
- package/dist/esm/react/canvas/list-chart-marks.js +37 -0
- package/dist/esm/react/canvas/marks.d.ts +19 -0
- package/dist/esm/react/canvas/marks.js +24 -0
- package/dist/esm/react/canvas/useNewLayout.d.ts +17 -0
- package/dist/esm/react/canvas/useNewLayout.js +44 -0
- package/dist/esm/react/canvas/zoom-levels.d.ts +28 -0
- package/dist/esm/react/canvas/zoom-levels.js +54 -0
- package/dist/esm/react/hooks/conversion-client.d.ts +77 -0
- package/dist/esm/react/hooks/conversion-client.js +132 -0
- package/dist/esm/react/hooks/describe-agent-selection.d.ts +6 -0
- package/dist/esm/react/hooks/describe-agent-selection.js +18 -0
- package/dist/esm/react/hooks/describe-load-outcome.d.ts +13 -0
- package/dist/esm/react/hooks/describe-load-outcome.js +30 -0
- package/dist/esm/react/hooks/download-config.d.ts +6 -0
- package/dist/esm/react/hooks/download-config.js +11 -0
- package/dist/esm/react/hooks/example-location.d.ts +7 -0
- package/dist/esm/react/hooks/example-location.js +14 -0
- package/dist/esm/react/hooks/label-source.d.ts +21 -0
- package/dist/esm/react/hooks/label-source.js +19 -0
- package/dist/esm/react/hooks/parse-config-text.d.ts +16 -0
- package/dist/esm/react/hooks/parse-config-text.js +38 -0
- package/dist/esm/react/hooks/useAgentBridge.d.ts +28 -0
- package/dist/esm/react/hooks/useAgentBridge.js +52 -0
- package/dist/esm/react/hooks/useAgentSync.d.ts +29 -0
- package/dist/esm/react/hooks/useAgentSync.js +75 -0
- package/dist/esm/react/hooks/useChartLayout.d.ts +25 -0
- package/dist/esm/react/hooks/useChartLayout.js +29 -0
- package/dist/esm/react/hooks/useConversion.d.ts +31 -0
- package/dist/esm/react/hooks/useConversion.js +177 -0
- package/dist/esm/react/hooks/useConvertDraft.d.ts +18 -0
- package/dist/esm/react/hooks/useConvertDraft.js +11 -0
- package/dist/esm/react/hooks/useDocumentTitle.d.ts +2 -0
- package/dist/esm/react/hooks/useDocumentTitle.js +7 -0
- package/dist/esm/react/hooks/useEscapeToClear.d.ts +2 -0
- package/dist/esm/react/hooks/useEscapeToClear.js +16 -0
- package/dist/esm/react/hooks/useHarnessList.d.ts +26 -0
- package/dist/esm/react/hooks/useHarnessList.js +24 -0
- package/dist/esm/react/hooks/usePromptDirectory.d.ts +27 -0
- package/dist/esm/react/hooks/usePromptDirectory.js +34 -0
- package/dist/esm/react/hooks/useSelection.d.ts +17 -0
- package/dist/esm/react/hooks/useSelection.js +21 -0
- package/dist/esm/react/hooks/useShowAmbient.d.ts +7 -0
- package/dist/esm/react/hooks/useShowAmbient.js +22 -0
- package/dist/esm/react/hooks/useUnknownExample.d.ts +7 -0
- package/dist/esm/react/hooks/useUnknownExample.js +26 -0
- package/dist/esm/react/index.d.ts +24 -0
- package/dist/esm/react/index.js +23 -0
- package/dist/esm/react/styles.css +482 -0
- package/dist/esm/schema/agent-logic-schema.d.ts +439 -0
- package/dist/esm/schema/agent-logic-schema.js +100 -0
- package/dist/esm/schema/config-traversal.d.ts +19 -0
- package/dist/esm/schema/config-traversal.js +32 -0
- package/dist/esm/schema/validate-config.d.ts +17 -0
- package/dist/esm/schema/validate-config.js +205 -0
- package/dist/esm/schema/write-json-schema.d.ts +4 -0
- package/dist/esm/schema/write-json-schema.js +12 -0
- package/dist/esm/server/conversion-job-implementation.d.ts +11 -0
- package/dist/esm/server/conversion-job-implementation.js +84 -0
- package/dist/esm/server/create-prompts-app.d.ts +26 -0
- package/dist/esm/server/create-prompts-app.js +41 -0
- package/dist/esm/server/create-viewer-server-plugins.d.ts +15 -0
- package/dist/esm/server/create-viewer-server-plugins.js +76 -0
- package/dist/esm/server/index.d.ts +7 -0
- package/dist/esm/server/index.js +6 -0
- package/dist/esm/server/prompt-directory-schemas.d.ts +30 -0
- package/dist/esm/server/prompt-directory-schemas.js +11 -0
- package/dist/esm/server/prompt-directory.d.ts +40 -0
- package/dist/esm/server/prompt-directory.js +86 -0
- package/dist/esm/server/viewer-contract-implementation.d.ts +12 -0
- package/dist/esm/server/viewer-contract-implementation.js +85 -0
- package/dist/esm/source/fence.d.ts +16 -0
- package/dist/esm/source/fence.js +15 -0
- package/dist/esm/source/find-comment-spans.d.ts +6 -0
- package/dist/esm/source/find-comment-spans.js +60 -0
- package/dist/esm/source/find-occurrences.d.ts +2 -0
- package/dist/esm/source/find-occurrences.js +7 -0
- package/dist/esm/source/prompt-segments.d.ts +21 -0
- package/dist/esm/source/prompt-segments.js +65 -0
- package/docs/conversion-agreement.md +37 -0
- package/docs/corpus.md +19 -0
- package/docs/extraction-rules.md +123 -0
- package/package.json +108 -2
- package/schema/agent-logic.schema.json +475 -0
package/package.json
CHANGED
|
@@ -1,4 +1,110 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeassembly-agent-logic",
|
|
3
|
-
"version": "0.
|
|
4
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Model of an agent prompt's states and transitions, with React and server entries for the apps that present it",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agents",
|
|
7
|
+
"ai",
|
|
8
|
+
"react",
|
|
9
|
+
"statechart"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/williamthorsen/codeassembly/tree/main/packages/agent-logic#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/williamthorsen/codeassembly/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/williamthorsen/codeassembly.git",
|
|
18
|
+
"directory": "packages/agent-logic"
|
|
19
|
+
},
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"author": "William Thorsen <william@thorsen.dev> (https://github.com/williamthorsen)",
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"*.css"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/esm/index.d.ts",
|
|
29
|
+
"import": "./dist/esm/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./agent-logic.schema.json": "./schema/agent-logic.schema.json",
|
|
32
|
+
"./contract": {
|
|
33
|
+
"types": "./dist/esm/contract/index.d.ts",
|
|
34
|
+
"import": "./dist/esm/contract/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./react": {
|
|
37
|
+
"types": "./dist/esm/react/index.d.ts",
|
|
38
|
+
"import": "./dist/esm/react/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./react/styles.css": "./dist/esm/react/styles.css",
|
|
41
|
+
"./server": {
|
|
42
|
+
"types": "./dist/esm/server/index.d.ts",
|
|
43
|
+
"import": "./dist/esm/server/index.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"main": "./dist/esm/index.js",
|
|
47
|
+
"bin": {
|
|
48
|
+
"agent-logic": "bin/agent-logic.js"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"bin",
|
|
52
|
+
"dist",
|
|
53
|
+
"docs",
|
|
54
|
+
"schema",
|
|
55
|
+
"CHANGELOG.md",
|
|
56
|
+
".meta/changelog.json"
|
|
57
|
+
],
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@hono/node-server": "2.1.6",
|
|
60
|
+
"@williamthorsen/toolbelt.errors": "0.9.0",
|
|
61
|
+
"@xyflow/react": "12.12.1",
|
|
62
|
+
"elkjs": "0.12.1",
|
|
63
|
+
"hono": "4.13.17",
|
|
64
|
+
"zod": "4.6.7"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@testing-library/dom": "10.4.2",
|
|
68
|
+
"@testing-library/jest-dom": "7.0.1",
|
|
69
|
+
"@testing-library/react": "16.3.3",
|
|
70
|
+
"@testing-library/user-event": "14.6.8",
|
|
71
|
+
"@types/node": "24.19.2",
|
|
72
|
+
"@types/react": "19.3.0",
|
|
73
|
+
"@types/react-dom": "19.3.0",
|
|
74
|
+
"@vitejs/plugin-react": "6.2.1",
|
|
75
|
+
"@williamthorsen/nmr": "0.56.0",
|
|
76
|
+
"@williamthorsen/telefactor": "0.4.1",
|
|
77
|
+
"eslint": "10.14.0",
|
|
78
|
+
"eslint-plugin-jest-dom": "5.10.1",
|
|
79
|
+
"eslint-plugin-react": "7.37.5",
|
|
80
|
+
"eslint-plugin-react-hooks": "7.1.1",
|
|
81
|
+
"eslint-plugin-testing-library": "7.16.2",
|
|
82
|
+
"happy-dom": "21.0.4",
|
|
83
|
+
"react": "19.3.1",
|
|
84
|
+
"react-dom": "19.3.1",
|
|
85
|
+
"vite": "8.3.6",
|
|
86
|
+
"vitest": "5.1.0",
|
|
87
|
+
"xstate": "5.33.4"
|
|
88
|
+
},
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"@williamthorsen/telefactor": "^0.4.1",
|
|
91
|
+
"react": "^19.0.0"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"@williamthorsen/telefactor": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"react": {
|
|
98
|
+
"optional": true
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"engines": {
|
|
102
|
+
"node": ">=24"
|
|
103
|
+
},
|
|
104
|
+
"scripts": {
|
|
105
|
+
"build:post": "cp src/react/styles.css dist/esm/react/styles.css",
|
|
106
|
+
"generate:schema": "node src/schema/write-json-schema.ts",
|
|
107
|
+
"refresh-corpus": "node src/corpus/refresh-corpus.ts",
|
|
108
|
+
"score-corpus": "node src/corpus/score-corpus-command.ts"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"id": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"minLength": 1
|
|
8
|
+
},
|
|
9
|
+
"on": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"propertyNames": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z0-9_]+)+$",
|
|
14
|
+
"description": "A dotted lowercase event name; events from the user start with `user.`."
|
|
15
|
+
},
|
|
16
|
+
"additionalProperties": {
|
|
17
|
+
"anyOf": [
|
|
18
|
+
{
|
|
19
|
+
"$ref": "#/$defs/Transition"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"minItems": 1,
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": {
|
|
25
|
+
"$ref": "#/$defs/Transition"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"always": {
|
|
32
|
+
"anyOf": [
|
|
33
|
+
{
|
|
34
|
+
"$ref": "#/$defs/Transition"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"minItems": 1,
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": {
|
|
40
|
+
"$ref": "#/$defs/Transition"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"entry": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"$ref": "#/$defs/Action"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"exit": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"items": {
|
|
54
|
+
"$ref": "#/$defs/Action"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"initial": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
},
|
|
60
|
+
"states": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"propertyNames": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"additionalProperties": {
|
|
66
|
+
"$ref": "#/$defs/State"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"meta": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"name": {
|
|
73
|
+
"description": "The name that the viewer shows for the state, written as words. Absent, the viewer shows the id.",
|
|
74
|
+
"type": "string",
|
|
75
|
+
"minLength": 1
|
|
76
|
+
},
|
|
77
|
+
"prompt": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
},
|
|
80
|
+
"source": {
|
|
81
|
+
"$ref": "#/$defs/Span"
|
|
82
|
+
},
|
|
83
|
+
"unconverted": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"properties": {
|
|
88
|
+
"start": {
|
|
89
|
+
"type": "integer",
|
|
90
|
+
"minimum": 0,
|
|
91
|
+
"maximum": 9007199254740991
|
|
92
|
+
},
|
|
93
|
+
"end": {
|
|
94
|
+
"type": "integer",
|
|
95
|
+
"minimum": 0,
|
|
96
|
+
"maximum": 9007199254740991
|
|
97
|
+
},
|
|
98
|
+
"reason": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"minLength": 1
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"required": [
|
|
104
|
+
"start",
|
|
105
|
+
"end"
|
|
106
|
+
],
|
|
107
|
+
"additionalProperties": false
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"ambient": {
|
|
111
|
+
"description": "Spans of the ambient instructions that hold throughout the state, such as persona, tone, background knowledge, and standing rules. Allowed only on the root and on a compound state.",
|
|
112
|
+
"type": "array",
|
|
113
|
+
"items": {
|
|
114
|
+
"$ref": "#/$defs/AmbientSpan"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"findings": {
|
|
118
|
+
"description": "The converter's judgment of flaws in the prompt that concern this element, or the prompt as a whole on the root. An `inferred-resolution` finding sits on the inferred element that it explains.",
|
|
119
|
+
"type": "array",
|
|
120
|
+
"items": {
|
|
121
|
+
"$ref": "#/$defs/Finding"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"required": [
|
|
126
|
+
"prompt",
|
|
127
|
+
"source",
|
|
128
|
+
"unconverted"
|
|
129
|
+
],
|
|
130
|
+
"additionalProperties": false
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": [
|
|
134
|
+
"id",
|
|
135
|
+
"initial",
|
|
136
|
+
"states",
|
|
137
|
+
"meta"
|
|
138
|
+
],
|
|
139
|
+
"additionalProperties": false,
|
|
140
|
+
"title": "Agent logic config",
|
|
141
|
+
"$defs": {
|
|
142
|
+
"Transition": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"properties": {
|
|
145
|
+
"target": {
|
|
146
|
+
"description": "The `#id` of the target state. Omitted, the transition runs its actions without leaving.",
|
|
147
|
+
"type": "string",
|
|
148
|
+
"pattern": "^#.+$"
|
|
149
|
+
},
|
|
150
|
+
"guard": {
|
|
151
|
+
"$ref": "#/$defs/NlEntry"
|
|
152
|
+
},
|
|
153
|
+
"actions": {
|
|
154
|
+
"type": "array",
|
|
155
|
+
"items": {
|
|
156
|
+
"$ref": "#/$defs/Action"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"meta": {
|
|
160
|
+
"$ref": "#/$defs/ElementMeta"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"required": [
|
|
164
|
+
"meta"
|
|
165
|
+
],
|
|
166
|
+
"additionalProperties": false
|
|
167
|
+
},
|
|
168
|
+
"NlEntry": {
|
|
169
|
+
"type": "object",
|
|
170
|
+
"properties": {
|
|
171
|
+
"type": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"const": "nl"
|
|
174
|
+
},
|
|
175
|
+
"params": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"properties": {
|
|
178
|
+
"text": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"minLength": 1
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"required": [
|
|
184
|
+
"text"
|
|
185
|
+
],
|
|
186
|
+
"additionalProperties": false
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"required": [
|
|
190
|
+
"type",
|
|
191
|
+
"params"
|
|
192
|
+
],
|
|
193
|
+
"additionalProperties": false
|
|
194
|
+
},
|
|
195
|
+
"Action": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"properties": {
|
|
198
|
+
"type": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"const": "nl"
|
|
201
|
+
},
|
|
202
|
+
"params": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"properties": {
|
|
205
|
+
"text": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"minLength": 1
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"required": [
|
|
211
|
+
"text"
|
|
212
|
+
],
|
|
213
|
+
"additionalProperties": false
|
|
214
|
+
},
|
|
215
|
+
"meta": {
|
|
216
|
+
"type": "object",
|
|
217
|
+
"properties": {
|
|
218
|
+
"source": {
|
|
219
|
+
"$ref": "#/$defs/Span"
|
|
220
|
+
},
|
|
221
|
+
"gate": {
|
|
222
|
+
"type": "boolean",
|
|
223
|
+
"const": true
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"required": [
|
|
227
|
+
"source",
|
|
228
|
+
"gate"
|
|
229
|
+
],
|
|
230
|
+
"additionalProperties": false
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"required": [
|
|
234
|
+
"type",
|
|
235
|
+
"params"
|
|
236
|
+
],
|
|
237
|
+
"additionalProperties": false
|
|
238
|
+
},
|
|
239
|
+
"Span": {
|
|
240
|
+
"type": "object",
|
|
241
|
+
"properties": {
|
|
242
|
+
"start": {
|
|
243
|
+
"type": "integer",
|
|
244
|
+
"minimum": 0,
|
|
245
|
+
"maximum": 9007199254740991
|
|
246
|
+
},
|
|
247
|
+
"end": {
|
|
248
|
+
"type": "integer",
|
|
249
|
+
"minimum": 0,
|
|
250
|
+
"maximum": 9007199254740991
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"required": [
|
|
254
|
+
"start",
|
|
255
|
+
"end"
|
|
256
|
+
],
|
|
257
|
+
"additionalProperties": false
|
|
258
|
+
},
|
|
259
|
+
"ElementMeta": {
|
|
260
|
+
"type": "object",
|
|
261
|
+
"properties": {
|
|
262
|
+
"source": {
|
|
263
|
+
"$ref": "#/$defs/Span"
|
|
264
|
+
},
|
|
265
|
+
"inferred": {
|
|
266
|
+
"type": "boolean",
|
|
267
|
+
"const": true
|
|
268
|
+
},
|
|
269
|
+
"gate": {
|
|
270
|
+
"description": "Present when the passage is the body of a `<HARD-GATE>`, an absolute instruction, in the prompt.",
|
|
271
|
+
"type": "boolean",
|
|
272
|
+
"const": true
|
|
273
|
+
},
|
|
274
|
+
"ambient": {
|
|
275
|
+
"description": "Spans of the ambient instructions that hold throughout the state, such as persona, tone, background knowledge, and standing rules. Allowed only on the root and on a compound state.",
|
|
276
|
+
"type": "array",
|
|
277
|
+
"items": {
|
|
278
|
+
"$ref": "#/$defs/AmbientSpan"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"findings": {
|
|
282
|
+
"description": "The converter's judgment of flaws in the prompt that concern this element, or the prompt as a whole on the root. An `inferred-resolution` finding sits on the inferred element that it explains.",
|
|
283
|
+
"type": "array",
|
|
284
|
+
"items": {
|
|
285
|
+
"$ref": "#/$defs/Finding"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"required": [
|
|
290
|
+
"source"
|
|
291
|
+
],
|
|
292
|
+
"additionalProperties": false
|
|
293
|
+
},
|
|
294
|
+
"AmbientSpan": {
|
|
295
|
+
"type": "object",
|
|
296
|
+
"properties": {
|
|
297
|
+
"start": {
|
|
298
|
+
"type": "integer",
|
|
299
|
+
"minimum": 0,
|
|
300
|
+
"maximum": 9007199254740991
|
|
301
|
+
},
|
|
302
|
+
"end": {
|
|
303
|
+
"type": "integer",
|
|
304
|
+
"minimum": 0,
|
|
305
|
+
"maximum": 9007199254740991
|
|
306
|
+
},
|
|
307
|
+
"gate": {
|
|
308
|
+
"description": "Present when the passage is the body of a `<HARD-GATE>`, an absolute instruction, in the prompt.",
|
|
309
|
+
"type": "boolean",
|
|
310
|
+
"const": true
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"required": [
|
|
314
|
+
"start",
|
|
315
|
+
"end"
|
|
316
|
+
],
|
|
317
|
+
"additionalProperties": false
|
|
318
|
+
},
|
|
319
|
+
"Finding": {
|
|
320
|
+
"type": "object",
|
|
321
|
+
"properties": {
|
|
322
|
+
"kind": {
|
|
323
|
+
"$ref": "#/$defs/FindingKind"
|
|
324
|
+
},
|
|
325
|
+
"sources": {
|
|
326
|
+
"minItems": 1,
|
|
327
|
+
"type": "array",
|
|
328
|
+
"items": {
|
|
329
|
+
"$ref": "#/$defs/Span"
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
"reason": {
|
|
333
|
+
"type": "string",
|
|
334
|
+
"minLength": 1
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"required": [
|
|
338
|
+
"kind",
|
|
339
|
+
"sources",
|
|
340
|
+
"reason"
|
|
341
|
+
],
|
|
342
|
+
"additionalProperties": false
|
|
343
|
+
},
|
|
344
|
+
"FindingKind": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"enum": [
|
|
347
|
+
"contradiction",
|
|
348
|
+
"unused-input",
|
|
349
|
+
"unhandled-case",
|
|
350
|
+
"inferred-resolution"
|
|
351
|
+
]
|
|
352
|
+
},
|
|
353
|
+
"State": {
|
|
354
|
+
"type": "object",
|
|
355
|
+
"properties": {
|
|
356
|
+
"id": {
|
|
357
|
+
"type": "string",
|
|
358
|
+
"minLength": 1
|
|
359
|
+
},
|
|
360
|
+
"on": {
|
|
361
|
+
"type": "object",
|
|
362
|
+
"propertyNames": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z0-9_]+)+$",
|
|
365
|
+
"description": "A dotted lowercase event name; events from the user start with `user.`."
|
|
366
|
+
},
|
|
367
|
+
"additionalProperties": {
|
|
368
|
+
"anyOf": [
|
|
369
|
+
{
|
|
370
|
+
"$ref": "#/$defs/Transition"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"minItems": 1,
|
|
374
|
+
"type": "array",
|
|
375
|
+
"items": {
|
|
376
|
+
"$ref": "#/$defs/Transition"
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"always": {
|
|
383
|
+
"anyOf": [
|
|
384
|
+
{
|
|
385
|
+
"$ref": "#/$defs/Transition"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"minItems": 1,
|
|
389
|
+
"type": "array",
|
|
390
|
+
"items": {
|
|
391
|
+
"$ref": "#/$defs/Transition"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
"entry": {
|
|
397
|
+
"type": "array",
|
|
398
|
+
"items": {
|
|
399
|
+
"$ref": "#/$defs/Action"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"exit": {
|
|
403
|
+
"type": "array",
|
|
404
|
+
"items": {
|
|
405
|
+
"$ref": "#/$defs/Action"
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"type": {
|
|
409
|
+
"type": "string",
|
|
410
|
+
"const": "final"
|
|
411
|
+
},
|
|
412
|
+
"initial": {
|
|
413
|
+
"type": "string"
|
|
414
|
+
},
|
|
415
|
+
"meta": {
|
|
416
|
+
"$ref": "#/$defs/StateMeta"
|
|
417
|
+
},
|
|
418
|
+
"states": {
|
|
419
|
+
"type": "object",
|
|
420
|
+
"propertyNames": {
|
|
421
|
+
"type": "string"
|
|
422
|
+
},
|
|
423
|
+
"additionalProperties": {
|
|
424
|
+
"$ref": "#/$defs/State"
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
"required": [
|
|
429
|
+
"id",
|
|
430
|
+
"meta"
|
|
431
|
+
],
|
|
432
|
+
"additionalProperties": false
|
|
433
|
+
},
|
|
434
|
+
"StateMeta": {
|
|
435
|
+
"type": "object",
|
|
436
|
+
"properties": {
|
|
437
|
+
"source": {
|
|
438
|
+
"$ref": "#/$defs/Span"
|
|
439
|
+
},
|
|
440
|
+
"inferred": {
|
|
441
|
+
"type": "boolean",
|
|
442
|
+
"const": true
|
|
443
|
+
},
|
|
444
|
+
"gate": {
|
|
445
|
+
"description": "Present when the passage is the body of a `<HARD-GATE>`, an absolute instruction, in the prompt.",
|
|
446
|
+
"type": "boolean",
|
|
447
|
+
"const": true
|
|
448
|
+
},
|
|
449
|
+
"ambient": {
|
|
450
|
+
"description": "Spans of the ambient instructions that hold throughout the state, such as persona, tone, background knowledge, and standing rules. Allowed only on the root and on a compound state.",
|
|
451
|
+
"type": "array",
|
|
452
|
+
"items": {
|
|
453
|
+
"$ref": "#/$defs/AmbientSpan"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
"findings": {
|
|
457
|
+
"description": "The converter's judgment of flaws in the prompt that concern this element, or the prompt as a whole on the root. An `inferred-resolution` finding sits on the inferred element that it explains.",
|
|
458
|
+
"type": "array",
|
|
459
|
+
"items": {
|
|
460
|
+
"$ref": "#/$defs/Finding"
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
"name": {
|
|
464
|
+
"description": "The name that the viewer shows for the state, written as words. Absent, the viewer shows the id.",
|
|
465
|
+
"type": "string",
|
|
466
|
+
"minLength": 1
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
"required": [
|
|
470
|
+
"source"
|
|
471
|
+
],
|
|
472
|
+
"additionalProperties": false
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|