codeassembly-agent-logic 0.7.0 → 0.9.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 +50 -0
- package/CHANGELOG.md +17 -0
- package/README.md +26 -13
- package/dist/esm/agent/convert-with-agent.d.ts +3 -3
- package/dist/esm/agent/convert-with-agent.js +2 -1
- package/dist/esm/conversion-session/format-conversion-input.d.ts +9 -0
- package/dist/esm/conversion-session/format-conversion-input.js +11 -1
- package/dist/esm/job/create-conversion-job.d.ts +10 -1
- package/dist/esm/job/create-conversion-job.js +6 -2
- package/dist/esm/job/index.d.ts +1 -1
- package/dist/esm/job/index.js +1 -1
- package/dist/esm/react/canvas/StatechartCanvas.js +3 -7
- package/dist/esm/react/canvas/build-aria-label-config.d.ts +6 -0
- package/dist/esm/react/canvas/build-aria-label-config.js +14 -0
- package/package.json +3 -3
package/.meta/changelog.json
CHANGED
|
@@ -1,4 +1,54 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"date": "2026-11-22",
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"title": "🎉 Features",
|
|
8
|
+
"audience": "all",
|
|
9
|
+
"items": [
|
|
10
|
+
{
|
|
11
|
+
"description": "Adds `createConversionJobFromInput` to `codeassembly-agent-logic/job`, which recreates the job that `createConversionJob` created from the input that `runJob` posts, for use as the `createJob` option of `createJobHandler` at an operator's endpoint. (#2305)",
|
|
12
|
+
"hash": "1e507c103d73bfdd750a7c17c09ac4c06dfdeddf",
|
|
13
|
+
"entry": 1
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"title": "🐛 Bug fixes",
|
|
19
|
+
"audience": "all",
|
|
20
|
+
"items": [
|
|
21
|
+
{
|
|
22
|
+
"description": "Fixes the issue that `createConversionJob` and `convertWithAgent` accepted a prompt file name containing a newline and sent part of the name to the model as the prompt; both now throw for such a name before the conversion starts. (#2305)",
|
|
23
|
+
"hash": "1e507c103d73bfdd750a7c17c09ac4c06dfdeddf",
|
|
24
|
+
"entry": 2
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"version": "0.8.0",
|
|
32
|
+
"date": "2026-11-21",
|
|
33
|
+
"sections": [
|
|
34
|
+
{
|
|
35
|
+
"title": "🎉 Features",
|
|
36
|
+
"audience": "all",
|
|
37
|
+
"items": [
|
|
38
|
+
{
|
|
39
|
+
"description": "Changes the mouse wheel on the statechart canvas from zooming to panning, with Cmd+wheel on macOS, Ctrl+wheel elsewhere, and a trackpad pinch still zooming. (#2303)",
|
|
40
|
+
"hash": "0d95c949fa9683f2ce95d83a2141f3e9619f02b1",
|
|
41
|
+
"entry": 1
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"description": "Names the zoom shortcut in the labels and tooltips of the canvas's Zoom In and Zoom Out buttons: `Cmd+scroll` on macOS and `Ctrl+scroll` elsewhere. (#2303)",
|
|
45
|
+
"hash": "0d95c949fa9683f2ce95d83a2141f3e9619f02b1",
|
|
46
|
+
"entry": 2
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
2
52
|
{
|
|
3
53
|
"version": "0.7.0",
|
|
4
54
|
"date": "2026-11-21",
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.9.0 — 2026-11-22
|
|
6
|
+
|
|
7
|
+
### 🎉 Features
|
|
8
|
+
|
|
9
|
+
- Adds `createConversionJobFromInput` to `codeassembly-agent-logic/job`, which recreates the job that `createConversionJob` created from the input that `runJob` posts, for use as the `createJob` option of `createJobHandler` at an operator's endpoint. (#2305)
|
|
10
|
+
|
|
11
|
+
### 🐛 Bug fixes
|
|
12
|
+
|
|
13
|
+
- Fixes the issue that `createConversionJob` and `convertWithAgent` accepted a prompt file name containing a newline and sent part of the name to the model as the prompt; both now throw for such a name before the conversion starts. (#2305)
|
|
14
|
+
|
|
15
|
+
## 0.8.0 — 2026-11-21
|
|
16
|
+
|
|
17
|
+
### 🎉 Features
|
|
18
|
+
|
|
19
|
+
- Changes the mouse wheel on the statechart canvas from zooming to panning, with Cmd+wheel on macOS, Ctrl+wheel elsewhere, and a trackpad pinch still zooming. (#2303)
|
|
20
|
+
- Names the zoom shortcut in the labels and tooltips of the canvas's Zoom In and Zoom Out buttons: `Cmd+scroll` on macOS and `Ctrl+scroll` elsewhere. (#2303)
|
|
21
|
+
|
|
5
22
|
## 0.7.0 — 2026-11-21
|
|
6
23
|
|
|
7
24
|
### 🎉 Features
|
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<!-- section:release-notes -->
|
|
2
|
-
## Release notes — v0.
|
|
2
|
+
## Release notes — v0.9.0 (2026-11-22)
|
|
3
3
|
|
|
4
4
|
### 🎉 Features
|
|
5
5
|
|
|
6
|
-
-
|
|
6
|
+
- Adds `createConversionJobFromInput` to `codeassembly-agent-logic/job`, which recreates the job that `createConversionJob` created from the input that `runJob` posts, for use as the `createJob` option of `createJobHandler` at an operator's endpoint. (#2305)
|
|
7
7
|
|
|
8
8
|
### 🐛 Bug fixes
|
|
9
9
|
|
|
10
|
-
- Fixes the issue that `
|
|
10
|
+
- Fixes the issue that `createConversionJob` and `convertWithAgent` accepted a prompt file name containing a newline and sent part of the name to the model as the prompt; both now throw for such a name before the conversion starts. (#2305)
|
|
11
11
|
<!-- /section:release-notes -->
|
|
12
12
|
|
|
13
13
|
<!-- readme-type: library -->
|
|
@@ -34,16 +34,16 @@ if (result.ok) {
|
|
|
34
34
|
|
|
35
35
|
## Entries
|
|
36
36
|
|
|
37
|
-
| Entry | Exports
|
|
38
|
-
| -------------------------------------------------- |
|
|
39
|
-
| `codeassembly-agent-logic` | The config schema and its validation, the converter and coverage check, the chart description, its ELK graph (`buildElkGraph`), its layout, source marking, and the bundled examples.
|
|
40
|
-
| `codeassembly-agent-logic/agent` | `convertWithAgent`, which converts a prompt by directing an ACP agent through the conversion.
|
|
41
|
-
| `codeassembly-agent-logic/react` | `StatechartCanvas`, the key's entries as data (`CANVAS_KEY_ENTRIES` and the mark glyphs), `PromptPane` and its `PromptKey`, and the hooks of a page that presents a chart.
|
|
42
|
-
| `codeassembly-agent-logic/react/styles.css` | The stylesheet of the canvas and the prompt pane.
|
|
43
|
-
| `codeassembly-agent-logic/server` | `createConversionHandler`, which serves conversions on an ACP agent, and its stores.
|
|
44
|
-
| `codeassembly-agent-logic/client` | `createConversionClient`, the browser client of the routes that `createConversionHandler` serves.
|
|
45
|
-
| `codeassembly-agent-logic/job` | `createConversionJob`, which converts a prompt as a job of `@williamthorsen/toolbelt.llm`, in a page or a function.
|
|
46
|
-
| `codeassembly-agent-logic/agent-logic.schema.json` | The config's JSON Schema.
|
|
37
|
+
| Entry | Exports |
|
|
38
|
+
| -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `codeassembly-agent-logic` | The config schema and its validation, the converter and coverage check, the chart description, its ELK graph (`buildElkGraph`), its layout, source marking, and the bundled examples. |
|
|
40
|
+
| `codeassembly-agent-logic/agent` | `convertWithAgent`, which converts a prompt by directing an ACP agent through the conversion. |
|
|
41
|
+
| `codeassembly-agent-logic/react` | `StatechartCanvas`, the key's entries as data (`CANVAS_KEY_ENTRIES` and the mark glyphs), `PromptPane` and its `PromptKey`, and the hooks of a page that presents a chart. |
|
|
42
|
+
| `codeassembly-agent-logic/react/styles.css` | The stylesheet of the canvas and the prompt pane. |
|
|
43
|
+
| `codeassembly-agent-logic/server` | `createConversionHandler`, which serves conversions on an ACP agent, and its stores. |
|
|
44
|
+
| `codeassembly-agent-logic/client` | `createConversionClient`, the browser client of the routes that `createConversionHandler` serves. |
|
|
45
|
+
| `codeassembly-agent-logic/job` | `createConversionJob`, which converts a prompt as a job of `@williamthorsen/toolbelt.llm`, in a page or a function, and `createConversionJobFromInput`, which creates the job at an endpoint. |
|
|
46
|
+
| `codeassembly-agent-logic/agent-logic.schema.json` | The config's JSON Schema. |
|
|
47
47
|
|
|
48
48
|
React 19 is a peer of `./react`, `@williamthorsen/toolbelt.acp` and `@modelcontextprotocol/server` peers of `./agent` and `./server`, and `@williamthorsen/toolbelt.llm` a peer of `./job`.
|
|
49
49
|
|
|
@@ -84,6 +84,19 @@ if (outcome.status === 'completed') console.log(outcome.result);
|
|
|
84
84
|
|
|
85
85
|
`createConversionJob` returns a job for [`@williamthorsen/toolbelt.llm`](https://github.com/williamthorsen/toolbelt/tree/main/packages/llm#readme), which runs it in the page on a user's connection or at an operator's endpoint, without a harness. The job sends the instructions and the message that `convertWithAgent` sends, offers the same two tools with the same caps, and makes at most `MAX_ROUNDS` model requests. Its result is a `ConvertResult`, available once the conversion is finished: the config accepted, the prompt recorded out of scope, or the last of the 5 submissions rejected. A run that the model ends earlier is `unfinished`. Create a job for each run.
|
|
86
86
|
|
|
87
|
+
When the page runs the job at an operator's endpoint, `runJob` posts only the job's input, and the endpoint's `createJobHandler` creates the job from it. `createConversionJobFromInput` creates the job that `createConversionJob` created for that input, and throws for input that `createConversionJob` does not create:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { createConversionJobFromInput } from 'codeassembly-agent-logic/job';
|
|
91
|
+
import { createJobHandler } from '@williamthorsen/toolbelt.llm/proposed';
|
|
92
|
+
|
|
93
|
+
export const POST = createJobHandler({
|
|
94
|
+
createJob: createConversionJobFromInput,
|
|
95
|
+
connection: { provider: 'anthropic', model: 'claude-sonnet-5-5', apiKey: operatorKey },
|
|
96
|
+
maxInputLength: 100_000,
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
87
100
|
## Serving conversions
|
|
88
101
|
|
|
89
102
|
```ts
|
|
@@ -41,9 +41,9 @@ export type ConversionEvent = SessionEvent | {
|
|
|
41
41
|
* and submission, then a `result` event that contains the outcome of the last submission.
|
|
42
42
|
*
|
|
43
43
|
* Rejects before the agent starts when the profile cannot identify calls of the conversion's tools, which
|
|
44
|
-
* `codexProfile` cannot; when the agent ends its turn without submitting a draft;
|
|
45
|
-
* signal aborts; and, when the agent fails, with an error that names the cause, such
|
|
46
|
-
* in.
|
|
44
|
+
* `codexProfile` cannot, or when the name contains a newline; when the agent ends its turn without submitting a draft;
|
|
45
|
+
* with the signal's reason when the signal aborts; and, when the agent fails, with an error that names the cause, such
|
|
46
|
+
* as a harness that is not signed in.
|
|
47
47
|
*
|
|
48
48
|
* @stage proposed
|
|
49
49
|
* @experimental
|
|
@@ -17,6 +17,7 @@ export function createConvertWithAgent(runPromptImpl) {
|
|
|
17
17
|
if (agent.isToolServerCall === undefined) {
|
|
18
18
|
throw new Error(`The agent \`${agent.command}\` cannot convert a prompt: Its profile cannot identify calls of the conversion's tools, so they would be refused.`);
|
|
19
19
|
}
|
|
20
|
+
const input = formatConversionInput(prompt, name);
|
|
20
21
|
signal?.throwIfAborted();
|
|
21
22
|
const pending = [];
|
|
22
23
|
const session = createConversionSession({
|
|
@@ -34,7 +35,7 @@ export function createConvertWithAgent(runPromptImpl) {
|
|
|
34
35
|
agent,
|
|
35
36
|
cwd,
|
|
36
37
|
instructions: CONVERSION_INSTRUCTIONS,
|
|
37
|
-
prompt:
|
|
38
|
+
prompt: input,
|
|
38
39
|
tools: {
|
|
39
40
|
name: CONVERSION_SERVER_NAME,
|
|
40
41
|
createServer: () => createConversionServer(session),
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns the message that starts a conversion: a header line naming the prompt's file, a blank line, and the prompt.
|
|
3
|
+
* Throws for a name that contains a newline, which the header line cannot hold.
|
|
3
4
|
*/
|
|
4
5
|
export declare function formatConversionInput(prompt: string, name: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the prompt and the file name from which `formatConversionInput` formatted `input`. Throws when `input` is not
|
|
8
|
+
* in that format.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseConversionInput(input: string): {
|
|
11
|
+
prompt: string;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
const HEADER_PREFIX = 'Prompt file: ';
|
|
1
2
|
export function formatConversionInput(prompt, name) {
|
|
2
|
-
|
|
3
|
+
if (name.includes('\n'))
|
|
4
|
+
throw new Error(`The prompt's file name cannot contain a newline: ${JSON.stringify(name)}.`);
|
|
5
|
+
return `${HEADER_PREFIX}${name}\n\n${prompt}`;
|
|
6
|
+
}
|
|
7
|
+
export function parseConversionInput(input) {
|
|
8
|
+
const headerEnd = input.indexOf('\n');
|
|
9
|
+
if (!input.startsWith(HEADER_PREFIX) || headerEnd === -1 || input[headerEnd + 1] !== '\n') {
|
|
10
|
+
throw new Error('Conversion input must start with a `' + HEADER_PREFIX + '{name}` line followed by a blank line.');
|
|
11
|
+
}
|
|
12
|
+
return { prompt: input.slice(headerEnd + 2), name: input.slice(HEADER_PREFIX.length, headerEnd) };
|
|
3
13
|
}
|
|
@@ -20,9 +20,18 @@ export interface ConversionJobOptions {
|
|
|
20
20
|
* instructions and message as `convertWithAgent`, checks its coverage map through `check_coverage`, and submits each
|
|
21
21
|
* draft through `submit_draft`, with the same caps. The job's result is the outcome of the submission that finished
|
|
22
22
|
* the conversion: an accepted config, an out-of-scope verdict, or the problems of the last submission accepted. A run
|
|
23
|
-
* that the model ends before then is unfinished. Create a job for each run.
|
|
23
|
+
* that the model ends before then is unfinished. Create a job for each run. Throws for a name that contains a newline.
|
|
24
24
|
*
|
|
25
25
|
* @stage proposed
|
|
26
26
|
* @experimental
|
|
27
27
|
*/
|
|
28
28
|
export declare function createConversionJob({ prompt, name }: ConversionJobOptions): Job<ConvertResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates the job that `createConversionJob` creates for a prompt, from that job's `input`: the string that `runJob`
|
|
31
|
+
* posts to an operator's endpoint, for the `createJob` of `createJobHandler`. Throws when `input` is not one that
|
|
32
|
+
* `createConversionJob` creates.
|
|
33
|
+
*
|
|
34
|
+
* @stage proposed
|
|
35
|
+
* @experimental
|
|
36
|
+
*/
|
|
37
|
+
export declare function createConversionJobFromInput(input: string): Job<ConvertResult>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CHECK_COVERAGE_DESCRIPTION, SUBMIT_DRAFT_DESCRIPTION } from "../conversion-session/conversion-tools.js";
|
|
3
3
|
import { createConversionSession, MAX_COVERAGE_CHECKS, MAX_SUBMISSIONS, } from "../conversion-session/create-conversion-session.js";
|
|
4
|
-
import { formatConversionInput } from "../conversion-session/format-conversion-input.js";
|
|
4
|
+
import { formatConversionInput, parseConversionInput } from "../conversion-session/format-conversion-input.js";
|
|
5
5
|
import { coverageMapSchema } from "../coverage-map/coverage-map-schema.js";
|
|
6
6
|
import { CONVERSION_INSTRUCTIONS } from "../instructions/conversion-instructions.js";
|
|
7
7
|
export const MAX_ROUNDS = MAX_COVERAGE_CHECKS + MAX_SUBMISSIONS + 2;
|
|
8
8
|
export function createConversionJob({ prompt, name }) {
|
|
9
|
+
const input = formatConversionInput(prompt, name);
|
|
9
10
|
const session = createConversionSession({ prompt, name, onEvent: () => { } });
|
|
10
11
|
let finished;
|
|
11
12
|
const checkCoverage = {
|
|
@@ -25,9 +26,12 @@ export function createConversionJob({ prompt, name }) {
|
|
|
25
26
|
};
|
|
26
27
|
return {
|
|
27
28
|
instructions: CONVERSION_INSTRUCTIONS,
|
|
28
|
-
input
|
|
29
|
+
input,
|
|
29
30
|
tools: { check_coverage: checkCoverage, submit_draft: submitDraft },
|
|
30
31
|
maxRounds: MAX_ROUNDS,
|
|
31
32
|
readResult: () => finished,
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
export function createConversionJobFromInput(input) {
|
|
36
|
+
return createConversionJob(parseConversionInput(input));
|
|
37
|
+
}
|
package/dist/esm/job/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** `./job` entry: converts a prompt as a job of `@williamthorsen/toolbelt.llm`, in a page or a function. */
|
|
2
2
|
export { MAX_COVERAGE_CHECKS, MAX_SUBMISSIONS } from '../conversion-session/create-conversion-session.js';
|
|
3
3
|
export type { ConvertResult } from '../convert/convert-prompt.js';
|
|
4
|
-
export { type ConversionJobOptions, createConversionJob, MAX_ROUNDS } from './create-conversion-job.js';
|
|
4
|
+
export { type ConversionJobOptions, createConversionJob, createConversionJobFromInput, MAX_ROUNDS, } from './create-conversion-job.js';
|
package/dist/esm/job/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MAX_COVERAGE_CHECKS, MAX_SUBMISSIONS } from "../conversion-session/create-conversion-session.js";
|
|
2
|
-
export { createConversionJob, MAX_ROUNDS } from "./create-conversion-job.js";
|
|
2
|
+
export { createConversionJob, createConversionJobFromInput, MAX_ROUNDS, } from "./create-conversion-job.js";
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Background, Controls, EdgeChangeset, getNodesBounds, NodeChangeset, ReactFlow, ReactFlowProvider, useReactFlow, useReactFlowStoreApi, useViewportStore, } from '@xyflow/react';
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
4
|
import { AmbientSelectionContext } from "./AmbientSelectionContext.js";
|
|
5
|
+
import { buildAriaLabelConfig } from "./build-aria-label-config.js";
|
|
5
6
|
import { DetailLevelContext } from "./DetailLevelContext.js";
|
|
6
7
|
import { findElementBox } from "./find-element-box.js";
|
|
7
8
|
import { findViewCentre, readView } from "./find-view-centre.js";
|
|
@@ -20,12 +21,6 @@ const fitViewOptions = {
|
|
|
20
21
|
maxZoom: READING_ZOOM,
|
|
21
22
|
};
|
|
22
23
|
const MAX_ZOOM = 2;
|
|
23
|
-
const STATE_DESCRIPTION = "Press Enter or Space to select. Press Right arrow to move to the state's outgoing transitions, when it has any.";
|
|
24
|
-
const ariaLabelConfig = {
|
|
25
|
-
'node.a11yDescription.default': STATE_DESCRIPTION,
|
|
26
|
-
'node.a11yDescription.keyboardDisabled': STATE_DESCRIPTION,
|
|
27
|
-
'edge.a11yDescription.default': 'Press Enter or Space to select. Press Up or Down arrow to move between transitions from the same state, or Left arrow to return to that state.',
|
|
28
|
-
};
|
|
29
24
|
const DRAG_THRESHOLD = 3;
|
|
30
25
|
export function StatechartCanvas({ elements, renderKey, ...props }) {
|
|
31
26
|
const marks = useMemo(() => listChartMarks(elements), [elements]);
|
|
@@ -97,6 +92,7 @@ function StatechartFlow({ elements, selectedPath, onSelect, onViewportChange })
|
|
|
97
92
|
const height = useViewportStore((state) => state.height);
|
|
98
93
|
const bounds = useMemo(() => getNodesBounds(elements.nodes.filter(({ parentId }) => parentId === undefined)), [elements.nodes]);
|
|
99
94
|
const fitZoom = findFitZoom(bounds, width, height);
|
|
95
|
+
const ariaLabelConfig = useMemo(() => buildAriaLabelConfig(), []);
|
|
100
96
|
const detailLevel = useViewportStore((state) => findDetailLevel(state.transform[2]));
|
|
101
97
|
const isFitted = useRef(true);
|
|
102
98
|
const markMoved = useCallback(() => {
|
|
@@ -160,7 +156,7 @@ function StatechartFlow({ elements, selectedPath, onSelect, onViewportChange })
|
|
|
160
156
|
return (_jsx(DetailLevelContext.Provider, { value: detailLevel, children: _jsx(AmbientSelectionContext.Provider, { value: ambientSelection, children: _jsxs(ReactFlow, { className: `statechart-canvas__flow--${detailLevel}`, nodes: shownNodes, edges: shownEdges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodesChange: handleNodesChange, onEdgesChange: handleEdgesChange, onNodeClick: handleNodeClick, onMoveStart: (event) => {
|
|
161
157
|
if (event !== null)
|
|
162
158
|
markMoved();
|
|
163
|
-
}, ...(onViewportChange === undefined ? {} : { onMove: onViewportChange }), nodesDraggable: false, nodesConnectable: false, multiSelectionKeyCode: null, fitView: true, fitViewOptions: fitViewOptions, autoPanOnNodeFocus: false, ariaLabelConfig: ariaLabelConfig, minZoom: fitZoom, maxZoom: MAX_ZOOM, children: [_jsx(Background, {}), _jsx(ArrowheadDefs, {}), _jsx(Controls, { showInteractive: false, fitViewOptions: fitViewOptions, onFitView: () => {
|
|
159
|
+
}, ...(onViewportChange === undefined ? {} : { onMove: onViewportChange }), nodesDraggable: false, nodesConnectable: false, multiSelectionKeyCode: null, panOnScroll: true, fitView: true, fitViewOptions: fitViewOptions, autoPanOnNodeFocus: false, ariaLabelConfig: ariaLabelConfig, minZoom: fitZoom, maxZoom: MAX_ZOOM, children: [_jsx(Background, {}), _jsx(ArrowheadDefs, {}), _jsx(Controls, { showInteractive: false, fitViewOptions: fitViewOptions, onFitView: () => {
|
|
164
160
|
isFitted.current = true;
|
|
165
161
|
}, onZoomIn: markMoved, onZoomOut: markMoved }), _jsx(SelectionSync, { selectedPath: selectedPath, reportRef: reportRef, onCentre: markMoved }), _jsx(EdgeDragPan, { onPan: markMoved }), _jsx(FocusNavigation, { onCentre: markMoved }), _jsx(ZoomProperty, {})] }) }) }));
|
|
166
162
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AriaLabelConfig } from '@xyflow/react';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the canvas's labels, naming the zoom shortcut on the zoom buttons. The key is the one that React Flow's
|
|
4
|
+
* default `zoomActivationKeyCode` picks, by the same user-agent test.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildAriaLabelConfig(): Partial<AriaLabelConfig>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const STATE_DESCRIPTION = "Press Enter or Space to select. Press Right arrow to move to the state's outgoing transitions, when it has any.";
|
|
2
|
+
const baseAriaLabelConfig = {
|
|
3
|
+
'node.a11yDescription.default': STATE_DESCRIPTION,
|
|
4
|
+
'node.a11yDescription.keyboardDisabled': STATE_DESCRIPTION,
|
|
5
|
+
'edge.a11yDescription.default': 'Press Enter or Space to select. Press Up or Down arrow to move between transitions from the same state, or Left arrow to return to that state.',
|
|
6
|
+
};
|
|
7
|
+
export function buildAriaLabelConfig() {
|
|
8
|
+
const zoomKey = typeof navigator !== 'undefined' && navigator.userAgent.includes('Mac') ? 'Cmd' : 'Ctrl';
|
|
9
|
+
return {
|
|
10
|
+
...baseAriaLabelConfig,
|
|
11
|
+
'controls.zoomIn.ariaLabel': `Zoom In (${zoomKey}+scroll)`,
|
|
12
|
+
'controls.zoomOut.ariaLabel': `Zoom Out (${zoomKey}+scroll)`,
|
|
13
|
+
};
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeassembly-agent-logic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Model of an agent prompt's states and transitions, with React and server entries for the apps that present it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
"@types/react": "19.3.0",
|
|
81
81
|
"@types/react-dom": "19.3.0",
|
|
82
82
|
"@vitejs/plugin-react": "6.3.0",
|
|
83
|
-
"@williamthorsen/nmr": "2.3.
|
|
83
|
+
"@williamthorsen/nmr": "2.3.1",
|
|
84
84
|
"@williamthorsen/toolbelt.acp": "0.3.3",
|
|
85
85
|
"@williamthorsen/toolbelt.llm": "0.2.1",
|
|
86
86
|
"eslint": "10.15.0",
|
|
87
|
-
"eslint-plugin-jest-dom": "5.
|
|
87
|
+
"eslint-plugin-jest-dom": "5.11.0",
|
|
88
88
|
"eslint-plugin-react": "7.37.5",
|
|
89
89
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
90
90
|
"eslint-plugin-testing-library": "7.16.2",
|