@agimon-ai/po-infinite-canvas 0.0.0-alpha.190
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/LICENSE +149 -0
- package/README.md +40 -0
- package/dist/apiContracts.cjs +265 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +52 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +260 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/native.mjs +2449 -0
- package/dist/extensions/native.mjs.map +1 -0
- package/dist/extensions/server.cjs +928 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +923 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +2987 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +51 -0
- package/dist/index.d.mts +416 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/dist/type-Cmpmby3K.mjs +529 -0
- package/dist/type-Cmpmby3K.mjs.map +1 -0
- package/dist/type-PpP9V5t0.cjs +846 -0
- package/dist/type-PpP9V5t0.cjs.map +1 -0
- package/llms.txt +12 -0
- package/package.json +208 -0
- package/src/prompts/codemode-how-to-infinite-canvas/SKILL.md +79 -0
- package/src/prompts/help-how-to-infinite-canvas/SKILL.md +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
2
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
|
|
6
|
+
Licensor: Agimon Pty Ltd
|
|
7
|
+
Licensed Work: Po, the software in the Po source repository and the
|
|
8
|
+
packages released from it, in each version released by
|
|
9
|
+
the Licensor.
|
|
10
|
+
The Licensed Work is (c) 2026 Agimon Pty Ltd.
|
|
11
|
+
Material identified as third-party in the "Third-party
|
|
12
|
+
components" section at the end of this file or in a
|
|
13
|
+
NOTICE file, and any package or directory whose own
|
|
14
|
+
license file grants a different license, is not part of
|
|
15
|
+
the Licensed Work and remains under its own license.
|
|
16
|
+
Additional Use Grant: You may make production use of the Licensed Work if
|
|
17
|
+
your use is Eligible Use. "Eligible Use" is production use that falls
|
|
18
|
+
within at least one of the following:
|
|
19
|
+
|
|
20
|
+
(a) Personal Use. Use by an individual for their own personal purposes,
|
|
21
|
+
and not on behalf of, or for the benefit of, an employer, client, or
|
|
22
|
+
other Organization. Use by an individual in the course of employment
|
|
23
|
+
or engagement by an Organization is use by that Organization.
|
|
24
|
+
|
|
25
|
+
(b) Small Organization Use. Use by or on behalf of an Organization whose
|
|
26
|
+
Annual Revenue is less than USD 1,000,000.
|
|
27
|
+
|
|
28
|
+
(c) Non-profit, Education and Research Use. Use, regardless of Annual
|
|
29
|
+
Revenue, by (i) an Organization registered or recognized as a
|
|
30
|
+
non-profit or charitable organization under the laws of its
|
|
31
|
+
jurisdiction, for its non-profit purposes; (ii) an accredited school,
|
|
32
|
+
college, or university, for teaching, learning, or academic research;
|
|
33
|
+
or (iii) a publicly funded research institution, for its research.
|
|
34
|
+
|
|
35
|
+
(d) Service Provider Use. Use by a consultant, contractor, agency, or other
|
|
36
|
+
service provider, regardless of its own Annual Revenue, solely to
|
|
37
|
+
build, deploy, host, operate, or support the Licensed Work for a client
|
|
38
|
+
whose own use would be Eligible Use under (a), (b), or (c). A service
|
|
39
|
+
provider's use for its own purposes is Eligible Use only if the service
|
|
40
|
+
provider itself qualifies under (b) or (c).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Hosted services. Offering the Licensed Work to third parties as a hosted
|
|
44
|
+
or managed service whose primary value is the Licensed Work is Eligible
|
|
45
|
+
Use only if each such third party's own use would be Eligible Use.
|
|
46
|
+
|
|
47
|
+
Definitions. "Organization" means any company, partnership, sole
|
|
48
|
+
proprietorship, trust, association, government body, or other entity, and
|
|
49
|
+
includes an individual acting in a business or professional capacity.
|
|
50
|
+
"Affiliate" means any entity that directly or indirectly controls, is
|
|
51
|
+
controlled by, or is under common control with an Organization, where
|
|
52
|
+
"control" means ownership of more than 50% of the voting interests of an
|
|
53
|
+
entity or the power to direct its management and policies by contract or
|
|
54
|
+
otherwise. "Annual Revenue" means the total gross revenue of an
|
|
55
|
+
Organization and all of its Affiliates combined, from all sources and
|
|
56
|
+
whether or not related to the Licensed Work, for its most recently
|
|
57
|
+
completed fiscal year, or, if it has not completed a fiscal year, for the
|
|
58
|
+
twelve months before the use (or since its formation, if shorter),
|
|
59
|
+
converted into US dollars at the average exchange rate for that period.
|
|
60
|
+
Proceeds of equity or debt financing are not revenue.
|
|
61
|
+
|
|
62
|
+
Threshold. If an Organization stops qualifying under (b), its existing
|
|
63
|
+
production use remains Eligible Use for 90 days after it stops
|
|
64
|
+
qualifying, after which it must obtain a commercial license or stop
|
|
65
|
+
production use. Use that was Eligible Use when it occurred never requires
|
|
66
|
+
a commercial license after the fact.
|
|
67
|
+
Change Date: Four years from the date a version of the Licensed Work
|
|
68
|
+
is first publicly released by the Licensor.
|
|
69
|
+
Change License: Apache License, Version 2.0
|
|
70
|
+
|
|
71
|
+
For information about alternative licensing arrangements for the Licensed
|
|
72
|
+
Work, please visit: https://agimon.ai/licensing
|
|
73
|
+
|
|
74
|
+
Notice
|
|
75
|
+
|
|
76
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
77
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
78
|
+
under an Open Source License, as stated in this License.
|
|
79
|
+
|
|
80
|
+
-----------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
Business Source License 1.1
|
|
83
|
+
|
|
84
|
+
Terms
|
|
85
|
+
|
|
86
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
87
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
88
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
89
|
+
production use.
|
|
90
|
+
|
|
91
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
92
|
+
available distribution of a specific version of the Licensed Work under this
|
|
93
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
94
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
95
|
+
above terminate.
|
|
96
|
+
|
|
97
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
98
|
+
currently in effect as described in this License, you must purchase a
|
|
99
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
100
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
101
|
+
|
|
102
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
103
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
104
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
105
|
+
for each version of the Licensed Work released by Licensor.
|
|
106
|
+
|
|
107
|
+
You must conspicuously display this License on each original or modified copy
|
|
108
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
109
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
110
|
+
License apply to your use of that work.
|
|
111
|
+
|
|
112
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
113
|
+
terminate your rights under this License for the current and all other
|
|
114
|
+
versions of the Licensed Work.
|
|
115
|
+
|
|
116
|
+
This License does not grant you any right in any trademark or logo of
|
|
117
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
118
|
+
Licensor as expressly required by this License).
|
|
119
|
+
|
|
120
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
121
|
+
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
122
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
123
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
124
|
+
TITLE.
|
|
125
|
+
|
|
126
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
|
127
|
+
your works, and to refer to it using the trademark “Business Source License”,
|
|
128
|
+
as long as you comply with the Covenants of Licensor below.
|
|
129
|
+
|
|
130
|
+
Covenants of Licensor
|
|
131
|
+
|
|
132
|
+
In consideration of the right to use this License’s text and the “Business
|
|
133
|
+
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
134
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
135
|
+
|
|
136
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
137
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
138
|
+
where “compatible” means that software provided under the Change License can
|
|
139
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
140
|
+
later version. Licensor may specify additional Change Licenses without
|
|
141
|
+
limitation.
|
|
142
|
+
|
|
143
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
144
|
+
impose any additional restriction on the right granted in this License, as
|
|
145
|
+
the Additional Use Grant; or (b) insert the text “None”.
|
|
146
|
+
|
|
147
|
+
3. To specify a Change Date.
|
|
148
|
+
|
|
149
|
+
4. Not to modify this License in any other way.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @agimon-ai/po-infinite-canvas
|
|
2
|
+
|
|
3
|
+
Infinite canvas boards that connect artifacts, stories, and frames with labeled edges
|
|
4
|
+
|
|
5
|
+
## Requirements and selection
|
|
6
|
+
|
|
7
|
+
Requires Node.js 24 or newer. Optional Pi peer compatibility is declared in [package.json](package.json).
|
|
8
|
+
|
|
9
|
+
Add `@agimon-ai/po-infinite-canvas` to the appropriate selected package list in `.po/presets.yaml`. The package's `poServer` metadata identifies its native server entry.
|
|
10
|
+
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
Boards are `*.canvas.json` files in the workspace or in the session artifact folder (`artifact:<path>`). Nodes reference artifacts, stories, and frames by path instead of embedding their bytes, and labeled directed edges (`link`, `flow`, `sequence`) connect them. Saves use SHA-256 optimistic concurrency, so a board changed elsewhere is refused with a conflict instead of being overwritten.
|
|
14
|
+
|
|
15
|
+
Comment threads live in the same file under `comments`, pinned to a card, a connector, or a board point. The person starts and resolves them on the board; Po answers through `canvas.reply`. Removing a card or connector moves its threads to a board point instead of deleting them. Boards open in their own panel, so the Author tab stays hidden for them.
|
|
16
|
+
|
|
17
|
+
### Finding and starting boards
|
|
18
|
+
|
|
19
|
+
The Artifacts rail has an Infinite canvas section. "This session" lists `*.canvas.json` files in the session artifact folder; "Repository" lists workspace boards found by the `.canvas.json` suffix through the session files search, which returns at most 50 matches. Selecting a board opens it in Author.
|
|
20
|
+
|
|
21
|
+
The section's New button creates an empty board and opens it. Its folder comes from `canvas.directory` in `config.yaml` (repository first, then personal): a workspace-relative folder such as `docs/canvas`, or `artifact:<folder>`. Without it, boards go to `artifact:canvas`. New boards are named `untitled-board.canvas.json`, then `untitled-board-2.canvas.json`, and so on, so two people pressing New never share a file.
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
canvas:
|
|
25
|
+
directory: docs/canvas
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Help and authoring
|
|
29
|
+
|
|
30
|
+
The package publishes `src/prompts/help-how-to-infinite-canvas/SKILL.md` through a named resource route and `llms.txt`. Keep additional guides package-owned and in the publish allowlist; do not export Markdown or copy it into `dist`.
|
|
31
|
+
|
|
32
|
+
The build generates host entries from named `src/extensions` routes. For extension layout, scoped services and lifecycle obligations, follow [Po architecture](https://github.com/AgiFlow/po/blob/main/docs/architecture.md#extensions).
|
|
33
|
+
|
|
34
|
+
## Development
|
|
35
|
+
|
|
36
|
+
Run the package's `build`, `typecheck`, `test`, and `lint` scripts from this directory. Use `npm pack --dry-run` to inspect published contents before release.
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
|
+
let typebox = require("typebox");
|
|
7
|
+
require("typebox/value");
|
|
8
|
+
//#region src/constants/infiniteCanvas.ts
|
|
9
|
+
/** A note card holds at most this many characters, in the file and in the editor. */
|
|
10
|
+
const CANVAS_MAX_NOTE_LENGTH = 4e3;
|
|
11
|
+
const CANVAS_MAX_EDGES = 2e3;
|
|
12
|
+
const CANVAS_MAX_COMMENT_LENGTH = 2e3;
|
|
13
|
+
const MAX_REFERENCE_LENGTH = 1024;
|
|
14
|
+
const CANVAS_ID_PATTERN = "^[A-Za-z0-9_-]{1,64}$";
|
|
15
|
+
/** Built-in types match this too, so plugin types share one spelling rule. */
|
|
16
|
+
const CANVAS_NODE_TYPE_PATTERN = "^[a-z][a-z0-9-]{0,31}$";
|
|
17
|
+
const CanvasEdgeKindSchema = typebox.Type.Union([
|
|
18
|
+
typebox.Type.Literal("link"),
|
|
19
|
+
typebox.Type.Literal("flow"),
|
|
20
|
+
typebox.Type.Literal("sequence")
|
|
21
|
+
]);
|
|
22
|
+
const Point = typebox.Type.Object({
|
|
23
|
+
x: typebox.Type.Number(),
|
|
24
|
+
y: typebox.Type.Number()
|
|
25
|
+
});
|
|
26
|
+
const Label = typebox.Type.String({ maxLength: 200 });
|
|
27
|
+
const Id = typebox.Type.String({ pattern: CANVAS_ID_PATTERN });
|
|
28
|
+
/** Every field is optional here; per-type requirements are checked after the shape. Extra keys are preserved. */
|
|
29
|
+
const CanvasNodeRefSchema = typebox.Type.Object({
|
|
30
|
+
path: typebox.Type.Optional(typebox.Type.String({ maxLength: MAX_REFERENCE_LENGTH })),
|
|
31
|
+
timeSeconds: typebox.Type.Optional(typebox.Type.Number({ minimum: 0 })),
|
|
32
|
+
projectPath: typebox.Type.Optional(typebox.Type.String({ maxLength: MAX_REFERENCE_LENGTH })),
|
|
33
|
+
storyPath: typebox.Type.Optional(typebox.Type.String({ maxLength: MAX_REFERENCE_LENGTH })),
|
|
34
|
+
storyExport: typebox.Type.Optional(typebox.Type.String({ maxLength: 200 })),
|
|
35
|
+
capture: typebox.Type.Optional(typebox.Type.String({ maxLength: MAX_REFERENCE_LENGTH }))
|
|
36
|
+
});
|
|
37
|
+
const CanvasNodeSchema = typebox.Type.Object({
|
|
38
|
+
id: Id,
|
|
39
|
+
type: typebox.Type.String({ pattern: CANVAS_NODE_TYPE_PATTERN }),
|
|
40
|
+
position: Point,
|
|
41
|
+
size: typebox.Type.Optional(typebox.Type.Object({
|
|
42
|
+
width: typebox.Type.Number({ minimum: 0 }),
|
|
43
|
+
height: typebox.Type.Number({ minimum: 0 })
|
|
44
|
+
})),
|
|
45
|
+
label: typebox.Type.Optional(Label),
|
|
46
|
+
ref: typebox.Type.Optional(CanvasNodeRefSchema),
|
|
47
|
+
text: typebox.Type.Optional(typebox.Type.String({ maxLength: CANVAS_MAX_NOTE_LENGTH })),
|
|
48
|
+
data: typebox.Type.Optional(typebox.Type.Unknown())
|
|
49
|
+
});
|
|
50
|
+
const HandleSide = typebox.Type.Union([
|
|
51
|
+
typebox.Type.Literal("top"),
|
|
52
|
+
typebox.Type.Literal("right"),
|
|
53
|
+
typebox.Type.Literal("bottom"),
|
|
54
|
+
typebox.Type.Literal("left")
|
|
55
|
+
]);
|
|
56
|
+
const CanvasEdgeSchema = typebox.Type.Object({
|
|
57
|
+
id: Id,
|
|
58
|
+
source: Id,
|
|
59
|
+
target: Id,
|
|
60
|
+
label: typebox.Type.Optional(Label),
|
|
61
|
+
kind: typebox.Type.Optional(CanvasEdgeKindSchema),
|
|
62
|
+
/** The card sides the person drew the connector between; the view picks sides when these are left out. */
|
|
63
|
+
sourceHandle: typebox.Type.Optional(HandleSide),
|
|
64
|
+
targetHandle: typebox.Type.Optional(HandleSide)
|
|
65
|
+
});
|
|
66
|
+
/** A thread hangs on a card, a connector, or a board point; a point that lost its card names it in `detachedFrom`. */
|
|
67
|
+
const CanvasCommentAnchorSchema = typebox.Type.Union([
|
|
68
|
+
typebox.Type.Object({
|
|
69
|
+
kind: typebox.Type.Literal("node"),
|
|
70
|
+
nodeId: Id
|
|
71
|
+
}),
|
|
72
|
+
typebox.Type.Object({
|
|
73
|
+
kind: typebox.Type.Literal("edge"),
|
|
74
|
+
edgeId: Id
|
|
75
|
+
}),
|
|
76
|
+
typebox.Type.Object({
|
|
77
|
+
kind: typebox.Type.Literal("point"),
|
|
78
|
+
x: typebox.Type.Number(),
|
|
79
|
+
y: typebox.Type.Number(),
|
|
80
|
+
detachedFrom: typebox.Type.Optional(Label)
|
|
81
|
+
})
|
|
82
|
+
]);
|
|
83
|
+
const CanvasCommentMessageSchema = typebox.Type.Object({
|
|
84
|
+
author: typebox.Type.Union([typebox.Type.Literal("person"), typebox.Type.Literal("po")]),
|
|
85
|
+
body: typebox.Type.String({
|
|
86
|
+
minLength: 1,
|
|
87
|
+
maxLength: CANVAS_MAX_COMMENT_LENGTH
|
|
88
|
+
}),
|
|
89
|
+
/** ISO 8601. */
|
|
90
|
+
createdAt: typebox.Type.String({ maxLength: 40 })
|
|
91
|
+
});
|
|
92
|
+
const CanvasCommentSchema = typebox.Type.Object({
|
|
93
|
+
id: Id,
|
|
94
|
+
anchor: CanvasCommentAnchorSchema,
|
|
95
|
+
/** `asked` waits on Po and `replied` waits on the person, who resolves it unless they asked Po to. */
|
|
96
|
+
status: typebox.Type.Union([
|
|
97
|
+
typebox.Type.Literal("open"),
|
|
98
|
+
typebox.Type.Literal("asked"),
|
|
99
|
+
typebox.Type.Literal("replied"),
|
|
100
|
+
typebox.Type.Literal("resolved")
|
|
101
|
+
]),
|
|
102
|
+
messages: typebox.Type.Array(CanvasCommentMessageSchema, {
|
|
103
|
+
minItems: 1,
|
|
104
|
+
maxItems: 50
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
const CanvasDocumentSchema = typebox.Type.Object({
|
|
108
|
+
version: typebox.Type.Literal(1),
|
|
109
|
+
title: typebox.Type.Optional(Label),
|
|
110
|
+
viewport: typebox.Type.Optional(typebox.Type.Object({
|
|
111
|
+
x: typebox.Type.Number(),
|
|
112
|
+
y: typebox.Type.Number(),
|
|
113
|
+
zoom: typebox.Type.Number({ exclusiveMinimum: 0 })
|
|
114
|
+
})),
|
|
115
|
+
nodes: typebox.Type.Array(CanvasNodeSchema, { maxItems: 500 }),
|
|
116
|
+
edges: typebox.Type.Array(CanvasEdgeSchema, { maxItems: CANVAS_MAX_EDGES }),
|
|
117
|
+
comments: typebox.Type.Optional(typebox.Type.Array(CanvasCommentSchema, { maxItems: 200 }))
|
|
118
|
+
});
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/schemas/apiContracts.ts
|
|
121
|
+
const Text = typebox.Type.String();
|
|
122
|
+
const Sha = typebox.Type.String({ pattern: "^[a-f0-9]{64}$" });
|
|
123
|
+
/** A workspace-relative `*.canvas.json` path, or `artifact:<relative>` for the session's artifacts. */
|
|
124
|
+
const Path = typebox.Type.String({
|
|
125
|
+
minLength: 1,
|
|
126
|
+
maxLength: 1024
|
|
127
|
+
});
|
|
128
|
+
const Saved = typebox.Type.Object({
|
|
129
|
+
path: Text,
|
|
130
|
+
sha256: Sha
|
|
131
|
+
});
|
|
132
|
+
const Preview = typebox.Type.Union([
|
|
133
|
+
typebox.Type.Object({
|
|
134
|
+
kind: typebox.Type.Union([
|
|
135
|
+
typebox.Type.Literal("image"),
|
|
136
|
+
typebox.Type.Literal("video"),
|
|
137
|
+
typebox.Type.Literal("pdf")
|
|
138
|
+
]),
|
|
139
|
+
src: typebox.Type.Object({
|
|
140
|
+
scope: typebox.Type.Union([typebox.Type.Literal("workspace"), typebox.Type.Literal("artifacts")]),
|
|
141
|
+
path: Text
|
|
142
|
+
}),
|
|
143
|
+
mimeType: Text,
|
|
144
|
+
timeSeconds: typebox.Type.Optional(typebox.Type.Number())
|
|
145
|
+
}),
|
|
146
|
+
typebox.Type.Object({
|
|
147
|
+
kind: typebox.Type.Literal("text"),
|
|
148
|
+
text: Text,
|
|
149
|
+
language: typebox.Type.Optional(Text),
|
|
150
|
+
truncated: typebox.Type.Boolean()
|
|
151
|
+
}),
|
|
152
|
+
typebox.Type.Object({
|
|
153
|
+
kind: typebox.Type.Literal("table"),
|
|
154
|
+
sheet: typebox.Type.Optional(Text),
|
|
155
|
+
rows: typebox.Type.Array(typebox.Type.Array(Text)),
|
|
156
|
+
truncated: typebox.Type.Boolean()
|
|
157
|
+
}),
|
|
158
|
+
typebox.Type.Object({
|
|
159
|
+
kind: typebox.Type.Literal("slides"),
|
|
160
|
+
titles: typebox.Type.Array(Text),
|
|
161
|
+
truncated: typebox.Type.Boolean()
|
|
162
|
+
}),
|
|
163
|
+
typebox.Type.Object({
|
|
164
|
+
kind: typebox.Type.Literal("html"),
|
|
165
|
+
html: Text,
|
|
166
|
+
truncated: typebox.Type.Boolean()
|
|
167
|
+
}),
|
|
168
|
+
typebox.Type.Object({
|
|
169
|
+
kind: typebox.Type.Literal("custom"),
|
|
170
|
+
type: Text,
|
|
171
|
+
data: typebox.Type.Unknown()
|
|
172
|
+
}),
|
|
173
|
+
typebox.Type.Object({
|
|
174
|
+
kind: typebox.Type.Literal("unavailable"),
|
|
175
|
+
reason: Text
|
|
176
|
+
})
|
|
177
|
+
]);
|
|
178
|
+
const json = (schema) => ({
|
|
179
|
+
required: true,
|
|
180
|
+
contentType: "application/json",
|
|
181
|
+
schema
|
|
182
|
+
});
|
|
183
|
+
const route = {
|
|
184
|
+
scope: "session",
|
|
185
|
+
basePath: "infinite-canvas",
|
|
186
|
+
authentication: "owner"
|
|
187
|
+
};
|
|
188
|
+
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
189
|
+
version: 1,
|
|
190
|
+
dynamic: [],
|
|
191
|
+
sockets: [],
|
|
192
|
+
http: [
|
|
193
|
+
{
|
|
194
|
+
...route,
|
|
195
|
+
id: "infinite-canvas.document",
|
|
196
|
+
path: "/document",
|
|
197
|
+
method: "GET",
|
|
198
|
+
description: "Read and validate a *.canvas.json board.",
|
|
199
|
+
parameters: [{
|
|
200
|
+
name: "path",
|
|
201
|
+
in: "query",
|
|
202
|
+
required: true,
|
|
203
|
+
schema: Path
|
|
204
|
+
}],
|
|
205
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
|
|
206
|
+
path: Text,
|
|
207
|
+
kind: typebox.Type.Union([typebox.Type.Literal("workspace"), typebox.Type.Literal("artifact")]),
|
|
208
|
+
document: CanvasDocumentSchema,
|
|
209
|
+
sha256: Sha,
|
|
210
|
+
writable: typebox.Type.Boolean()
|
|
211
|
+
}))
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
...route,
|
|
215
|
+
id: "infinite-canvas.create",
|
|
216
|
+
path: "/document/create",
|
|
217
|
+
method: "POST",
|
|
218
|
+
description: "Create a new board; 409 when the file exists.",
|
|
219
|
+
body: json(typebox.Type.Object({
|
|
220
|
+
path: Path,
|
|
221
|
+
document: CanvasDocumentSchema
|
|
222
|
+
})),
|
|
223
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(Saved)
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
...route,
|
|
227
|
+
id: "infinite-canvas.new",
|
|
228
|
+
path: "/document/new",
|
|
229
|
+
method: "POST",
|
|
230
|
+
description: "Create an empty board in the configured canvas.directory (default artifact:canvas) under a free name.",
|
|
231
|
+
body: json(typebox.Type.Object({ title: typebox.Type.Optional(typebox.Type.String({ maxLength: 200 })) })),
|
|
232
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(Saved)
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
...route,
|
|
236
|
+
id: "infinite-canvas.write",
|
|
237
|
+
path: "/document",
|
|
238
|
+
method: "PUT",
|
|
239
|
+
description: "Replace a board while it still has expectedSha256; 409 when it changed elsewhere.",
|
|
240
|
+
body: json(typebox.Type.Object({
|
|
241
|
+
path: Path,
|
|
242
|
+
document: CanvasDocumentSchema,
|
|
243
|
+
expectedSha256: Sha
|
|
244
|
+
})),
|
|
245
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(Saved)
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
...route,
|
|
249
|
+
id: "infinite-canvas.previews",
|
|
250
|
+
path: "/previews",
|
|
251
|
+
method: "POST",
|
|
252
|
+
description: "Previews for up to 50 nodes; a node that cannot be shown answers unavailable.",
|
|
253
|
+
body: json(typebox.Type.Object({
|
|
254
|
+
path: Path,
|
|
255
|
+
nodeIds: typebox.Type.Array(Text, { maxItems: 50 })
|
|
256
|
+
})),
|
|
257
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ previews: typebox.Type.Record(Text, Preview) }))
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
});
|
|
261
|
+
//#endregion
|
|
262
|
+
exports.apiContracts = apiContracts;
|
|
263
|
+
exports.default = apiContracts;
|
|
264
|
+
|
|
265
|
+
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["Type","Type","defineApiContract","jsonApiResponses"],"sources":["../src/constants/infiniteCanvas.ts","../src/schemas/canvasDocument.ts","../src/schemas/apiContracts.ts"],"sourcesContent":["/** Every canvas board file ends with this suffix, in the workspace and in the session artifact folder. */\nexport const CANVAS_FILE_SUFFIX = '.canvas.json';\n/** Session artifact references start with this prefix, matching Author's spelling. */\nexport const CANVAS_ARTIFACT_PREFIX = 'artifact:';\n/** Space references start with this prefix and name the space before the first slash. */\nexport const CANVAS_SPACE_PREFIX = '@space:';\n/** The Author canvas type `*.canvas.json` files open as. */\nexport const INFINITE_CANVAS_TYPE = 'infinite-canvas';\n/** The session API mount under `/plugins/`. */\nexport const INFINITE_CANVAS_API_BASE_PATH = 'infinite-canvas';\n/** Direct event and channel frame announcing a saved board: `{ path, sha256 }`. */\nexport const INFINITE_CANVAS_CHANGED_EVENT = 'infinite_canvas_changed';\n/** The code-mode namespace name and the package that registers it. */\nexport const CANVAS_NAMESPACE_NAME = 'canvas';\nexport const CANVAS_PACKAGE_NAME = '@agimon-ai/po-infinite-canvas';\n/** At most this many node previews per call. */\nexport const CANVAS_MAX_PREVIEW_NODES = 50;\n/** Each node preview gets this long before it answers `unavailable`. */\nexport const CANVAS_PREVIEW_TIMEOUT_MS = 10_000;\n/** Node previews rendered at once. */\nexport const CANVAS_PREVIEW_CONCURRENCY = 8;\n/** A note card holds at most this many characters, in the file and in the editor. */\nexport const CANVAS_MAX_NOTE_LENGTH = 4000;\n/** Where a new board goes when `config.yaml` sets no `canvas.directory`. */\nexport const CANVAS_DEFAULT_DIRECTORY = 'artifact:canvas';\n/** The title a new board starts with when the person gives none. */\nexport const CANVAS_UNTITLED_TITLE = 'Untitled board';\n","import { type Static, Type } from 'typebox';\nimport { Check, Errors } from 'typebox/value';\n\nimport { CANVAS_ARTIFACT_PREFIX, CANVAS_MAX_NOTE_LENGTH, CANVAS_SPACE_PREFIX } from '../constants/infiniteCanvas';\n\n/** A board file never exceeds 1 MiB on disk. */\nexport const CANVAS_MAX_BYTES = 1024 * 1024;\nexport const CANVAS_MAX_NODES = 500;\nexport const CANVAS_MAX_EDGES = 2000;\nexport const CANVAS_MAX_LABEL_LENGTH = 200;\n/** Plugin `data` is bounded by its UTF-8 JSON size. */\nexport const CANVAS_MAX_DATA_BYTES = 16 * 1024;\nexport const CANVAS_MAX_COMMENTS = 200;\nexport const CANVAS_MAX_COMMENT_MESSAGES = 50;\nexport const CANVAS_MAX_COMMENT_LENGTH = 2000;\nconst MAX_REFERENCE_LENGTH = 1024;\n\nexport const CANVAS_ID_PATTERN = '^[A-Za-z0-9_-]{1,64}$';\n/** Built-in types match this too, so plugin types share one spelling rule. */\nexport const CANVAS_NODE_TYPE_PATTERN = '^[a-z][a-z0-9-]{0,31}$';\nexport const CANVAS_BUILTIN_NODE_TYPES = ['artifact', 'frame', 'story', 'note'] as const;\nexport const CANVAS_EDGE_KINDS = ['link', 'flow', 'sequence'] as const;\nexport const CANVAS_DEFAULT_EDGE_KIND = 'link';\n\nexport const CanvasEdgeKindSchema = Type.Union([Type.Literal('link'), Type.Literal('flow'), Type.Literal('sequence')]);\nconst Point = Type.Object({ x: Type.Number(), y: Type.Number() });\nconst Label = Type.String({ maxLength: CANVAS_MAX_LABEL_LENGTH });\nconst Id = Type.String({ pattern: CANVAS_ID_PATTERN });\n\n/** Every field is optional here; per-type requirements are checked after the shape. Extra keys are preserved. */\nexport const CanvasNodeRefSchema = Type.Object({\n path: Type.Optional(Type.String({ maxLength: MAX_REFERENCE_LENGTH })),\n timeSeconds: Type.Optional(Type.Number({ minimum: 0 })),\n projectPath: Type.Optional(Type.String({ maxLength: MAX_REFERENCE_LENGTH })),\n storyPath: Type.Optional(Type.String({ maxLength: MAX_REFERENCE_LENGTH })),\n storyExport: Type.Optional(Type.String({ maxLength: CANVAS_MAX_LABEL_LENGTH })),\n capture: Type.Optional(Type.String({ maxLength: MAX_REFERENCE_LENGTH })),\n});\n\nexport const CanvasNodeSchema = Type.Object({\n id: Id,\n type: Type.String({ pattern: CANVAS_NODE_TYPE_PATTERN }),\n position: Point,\n size: Type.Optional(Type.Object({ width: Type.Number({ minimum: 0 }), height: Type.Number({ minimum: 0 }) })),\n label: Type.Optional(Label),\n ref: Type.Optional(CanvasNodeRefSchema),\n text: Type.Optional(Type.String({ maxLength: CANVAS_MAX_NOTE_LENGTH })),\n data: Type.Optional(Type.Unknown()),\n});\n\nconst HandleSide = Type.Union([\n Type.Literal('top'),\n Type.Literal('right'),\n Type.Literal('bottom'),\n Type.Literal('left'),\n]);\n\nexport const CanvasEdgeSchema = Type.Object({\n id: Id,\n source: Id,\n target: Id,\n label: Type.Optional(Label),\n kind: Type.Optional(CanvasEdgeKindSchema),\n /** The card sides the person drew the connector between; the view picks sides when these are left out. */\n sourceHandle: Type.Optional(HandleSide),\n targetHandle: Type.Optional(HandleSide),\n});\n\n/** A thread hangs on a card, a connector, or a board point; a point that lost its card names it in `detachedFrom`. */\nexport const CanvasCommentAnchorSchema = Type.Union([\n Type.Object({ kind: Type.Literal('node'), nodeId: Id }),\n Type.Object({ kind: Type.Literal('edge'), edgeId: Id }),\n Type.Object({ kind: Type.Literal('point'), x: Type.Number(), y: Type.Number(), detachedFrom: Type.Optional(Label) }),\n]);\n\nexport const CanvasCommentMessageSchema = Type.Object({\n author: Type.Union([Type.Literal('person'), Type.Literal('po')]),\n body: Type.String({ minLength: 1, maxLength: CANVAS_MAX_COMMENT_LENGTH }),\n /** ISO 8601. */\n createdAt: Type.String({ maxLength: 40 }),\n});\n\nexport const CanvasCommentSchema = Type.Object({\n id: Id,\n anchor: CanvasCommentAnchorSchema,\n /** `asked` waits on Po and `replied` waits on the person, who resolves it unless they asked Po to. */\n status: Type.Union([Type.Literal('open'), Type.Literal('asked'), Type.Literal('replied'), Type.Literal('resolved')]),\n messages: Type.Array(CanvasCommentMessageSchema, { minItems: 1, maxItems: CANVAS_MAX_COMMENT_MESSAGES }),\n});\n\nexport const CanvasDocumentSchema = Type.Object({\n version: Type.Literal(1),\n title: Type.Optional(Label),\n viewport: Type.Optional(\n Type.Object({ x: Type.Number(), y: Type.Number(), zoom: Type.Number({ exclusiveMinimum: 0 }) }),\n ),\n nodes: Type.Array(CanvasNodeSchema, { maxItems: CANVAS_MAX_NODES }),\n edges: Type.Array(CanvasEdgeSchema, { maxItems: CANVAS_MAX_EDGES }),\n comments: Type.Optional(Type.Array(CanvasCommentSchema, { maxItems: CANVAS_MAX_COMMENTS })),\n});\n\nexport type CanvasNodeRef = Static<typeof CanvasNodeRefSchema>;\nexport type CanvasNode = Static<typeof CanvasNodeSchema>;\nexport type CanvasEdge = Static<typeof CanvasEdgeSchema>;\nexport type CanvasComment = Static<typeof CanvasCommentSchema>;\nexport type CanvasEdgeKind = (typeof CANVAS_EDGE_KINDS)[number];\nexport type CanvasBuiltinNodeType = (typeof CANVAS_BUILTIN_NODE_TYPES)[number];\nexport type CanvasDocument = Static<typeof CanvasDocumentSchema>;\n\n/** A refused board: 400 for an invalid document, 413 for one over a size limit. */\nexport class CanvasDocumentError extends Error {\n constructor(\n message: string,\n readonly status: 400 | 413,\n ) {\n super(message);\n this.name = 'CanvasDocumentError';\n }\n}\n\nfunction relativeSegmentsValid(value: string): boolean {\n return (\n value.length > 0 &&\n !value.startsWith('/') &&\n value.split('/').every((segment) => segment !== '' && segment !== '.' && segment !== '..')\n );\n}\n\n/** A plain relative path: no absolute form, traversal, backslash, NUL, or URL scheme such as `file://`. */\nexport function isCanvasRelativePath(value: string): boolean {\n if (value.length > MAX_REFERENCE_LENGTH || value.includes('\\0') || value.includes('\\\\')) return false;\n // `C:` and every `scheme:` form are refused; artifact and space prefixes are handled by the caller.\n if (/^[A-Za-z][A-Za-z0-9+.-]*:/u.test(value)) return false;\n return relativeSegmentsValid(value);\n}\n\n/** A node reference: a workspace-relative path, `artifact:<rel>`, or `@space:<id>/<rel>`. */\nexport function isCanvasReferencePath(value: string): boolean {\n if (value.length > MAX_REFERENCE_LENGTH || value.includes('\\0') || value.includes('\\\\')) return false;\n if (value.startsWith(CANVAS_ARTIFACT_PREFIX)) return isCanvasRelativePath(value.slice(CANVAS_ARTIFACT_PREFIX.length));\n if (value.startsWith(CANVAS_SPACE_PREFIX)) {\n const rest = value.slice(CANVAS_SPACE_PREFIX.length);\n const slash = rest.indexOf('/');\n if (slash <= 0) return false;\n return /^[A-Za-z0-9_-]{1,64}$/u.test(rest.slice(0, slash)) && isCanvasRelativePath(rest.slice(slash + 1));\n }\n return isCanvasRelativePath(value);\n}\n\n/** The edge's kind, `link` when the file leaves it out. */\nexport function canvasEdgeKind(edge: Pick<CanvasEdge, 'kind'>): CanvasEdgeKind {\n return edge.kind ?? CANVAS_DEFAULT_EDGE_KIND;\n}\n\nconst utf8Length = (text: string): number => new TextEncoder().encode(text).byteLength;\n\nfunction invalid(message: string): never {\n throw new CanvasDocumentError(message, 400);\n}\n\nfunction finite(value: { [key: string]: unknown } | undefined, where: string): void {\n if (value === undefined) return;\n for (const [key, entry] of Object.entries(value))\n if (typeof entry === 'number' && !Number.isFinite(entry)) invalid(`${where}.${key} must be a finite number.`);\n}\n\nfunction checkReference(value: string | undefined, where: string, check: (value: string) => boolean): void {\n if (value !== undefined && !check(value))\n invalid(`${where} must be a workspace-relative path, artifact:<path>, or @space:<id>/<path>.`);\n}\n\nfunction checkNode(node: CanvasNode, index: number): void {\n const where = `nodes[${index}]`;\n finite(node.position, `${where}.position`);\n finite(node.size, `${where}.size`);\n const ref = node.ref;\n checkReference(ref?.path, `${where}.ref.path`, isCanvasReferencePath);\n checkReference(ref?.capture, `${where}.ref.capture`, isCanvasReferencePath);\n checkReference(ref?.projectPath, `${where}.ref.projectPath`, isCanvasRelativePath);\n checkReference(ref?.storyPath, `${where}.ref.storyPath`, isCanvasRelativePath);\n if (ref?.timeSeconds !== undefined && !Number.isFinite(ref.timeSeconds))\n invalid(`${where}.ref.timeSeconds must be a finite number.`);\n if ((node.type === 'artifact' || node.type === 'frame') && !ref?.path) invalid(`${where} needs ref.path.`);\n if (node.type === 'story' && (!ref?.projectPath || !ref.storyPath))\n invalid(`${where} needs ref.projectPath and ref.storyPath.`);\n if (node.data !== undefined) {\n const json = JSON.stringify(node.data);\n if (json === undefined) invalid(`${where}.data must be JSON.`);\n if (utf8Length(json) > CANVAS_MAX_DATA_BYTES)\n throw new CanvasDocumentError(`${where}.data exceeds ${CANVAS_MAX_DATA_BYTES} bytes.`, 413);\n }\n}\n\n/**\n * Validate a board and return a detached copy. Unknown node types and extra keys survive unchanged, so a board saved\n * by a newer plugin round-trips through this one.\n */\nexport function parseCanvasDocument(input: unknown): CanvasDocument {\n if (!Check(CanvasDocumentSchema, input)) {\n const [first] = Errors(CanvasDocumentSchema, input);\n invalid(`Invalid canvas document${first ? ` at ${first.instancePath || '/'}: ${first.message}` : ''}.`);\n }\n const document = structuredClone(input);\n finite(document.viewport, 'viewport');\n const ids = new Set<string>();\n document.nodes.forEach((node, index) => {\n if (ids.has(node.id)) invalid(`Duplicate node id ${node.id}.`);\n ids.add(node.id);\n checkNode(node, index);\n });\n const edgeIds = new Set<string>();\n for (const edge of document.edges) {\n if (edgeIds.has(edge.id)) invalid(`Duplicate edge id ${edge.id}.`);\n edgeIds.add(edge.id);\n if (!ids.has(edge.source) || !ids.has(edge.target)) invalid(`Edge ${edge.id} must connect existing nodes.`);\n }\n const commentIds = new Set<string>();\n for (const comment of document.comments ?? []) {\n if (commentIds.has(comment.id)) invalid(`Duplicate comment id ${comment.id}.`);\n commentIds.add(comment.id);\n const { anchor } = comment;\n if (anchor.kind === 'node' && !ids.has(anchor.nodeId))\n invalid(`Comment ${comment.id} must hang on an existing node.`);\n if (anchor.kind === 'edge' && !edgeIds.has(anchor.edgeId))\n invalid(`Comment ${comment.id} must hang on an existing edge.`);\n if (anchor.kind === 'point' && !(Number.isFinite(anchor.x) && Number.isFinite(anchor.y)))\n invalid(`Comment ${comment.id} anchor must be a finite point.`);\n }\n return document;\n}\n\n/** Parse board file text, refusing anything over 1 MiB before decoding it as JSON. */\nexport function parseCanvasText(text: string): CanvasDocument {\n if (utf8Length(text) > CANVAS_MAX_BYTES)\n throw new CanvasDocumentError(`Canvas exceeds the ${CANVAS_MAX_BYTES} byte limit.`, 413);\n let value: unknown;\n try {\n value = JSON.parse(text);\n } catch {\n invalid('Canvas file is not valid JSON.');\n }\n return parseCanvasDocument(value);\n}\n\n/** Validate and encode a board as stable, indented JSON within the 1 MiB file limit. */\nexport function serializeCanvasDocument(document: unknown): string {\n const text = `${JSON.stringify(parseCanvasDocument(document), null, 2)}\\n`;\n if (utf8Length(text) > CANVAS_MAX_BYTES)\n throw new CanvasDocumentError(`Canvas exceeds the ${CANVAS_MAX_BYTES} byte limit.`, 413);\n return text;\n}\n","import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nimport { CanvasDocumentSchema } from './canvasDocument';\n\nconst Text = Type.String();\nconst Sha = Type.String({ pattern: '^[a-f0-9]{64}$' });\n/** A workspace-relative `*.canvas.json` path, or `artifact:<relative>` for the session's artifacts. */\nconst Path = Type.String({ minLength: 1, maxLength: 1024 });\nconst Saved = Type.Object({ path: Text, sha256: Sha });\nconst Preview = Type.Union([\n Type.Object({\n kind: Type.Union([Type.Literal('image'), Type.Literal('video'), Type.Literal('pdf')]),\n src: Type.Object({ scope: Type.Union([Type.Literal('workspace'), Type.Literal('artifacts')]), path: Text }),\n mimeType: Text,\n timeSeconds: Type.Optional(Type.Number()),\n }),\n Type.Object({ kind: Type.Literal('text'), text: Text, language: Type.Optional(Text), truncated: Type.Boolean() }),\n Type.Object({\n kind: Type.Literal('table'),\n sheet: Type.Optional(Text),\n rows: Type.Array(Type.Array(Text)),\n truncated: Type.Boolean(),\n }),\n Type.Object({ kind: Type.Literal('slides'), titles: Type.Array(Text), truncated: Type.Boolean() }),\n Type.Object({ kind: Type.Literal('html'), html: Text, truncated: Type.Boolean() }),\n Type.Object({ kind: Type.Literal('custom'), type: Text, data: Type.Unknown() }),\n Type.Object({ kind: Type.Literal('unavailable'), reason: Text }),\n]);\nconst json = (schema: object) => ({ required: true, contentType: 'application/json', schema });\nconst route = { scope: 'session' as const, basePath: 'infinite-canvas', authentication: 'owner' as const };\n\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n sockets: [],\n http: [\n {\n ...route,\n id: 'infinite-canvas.document',\n path: '/document',\n method: 'GET',\n description: 'Read and validate a *.canvas.json board.',\n parameters: [{ name: 'path', in: 'query', required: true, schema: Path }],\n responses: jsonApiResponses(\n Type.Object({\n path: Text,\n kind: Type.Union([Type.Literal('workspace'), Type.Literal('artifact')]),\n document: CanvasDocumentSchema,\n sha256: Sha,\n writable: Type.Boolean(),\n }),\n ),\n },\n {\n ...route,\n id: 'infinite-canvas.create',\n path: '/document/create',\n method: 'POST',\n description: 'Create a new board; 409 when the file exists.',\n body: json(Type.Object({ path: Path, document: CanvasDocumentSchema })),\n responses: jsonApiResponses(Saved),\n },\n {\n ...route,\n id: 'infinite-canvas.new',\n path: '/document/new',\n method: 'POST',\n description:\n 'Create an empty board in the configured canvas.directory (default artifact:canvas) under a free name.',\n body: json(Type.Object({ title: Type.Optional(Type.String({ maxLength: 200 })) })),\n responses: jsonApiResponses(Saved),\n },\n {\n ...route,\n id: 'infinite-canvas.write',\n path: '/document',\n method: 'PUT',\n description: 'Replace a board while it still has expectedSha256; 409 when it changed elsewhere.',\n body: json(Type.Object({ path: Path, document: CanvasDocumentSchema, expectedSha256: Sha })),\n responses: jsonApiResponses(Saved),\n },\n {\n ...route,\n id: 'infinite-canvas.previews',\n path: '/previews',\n method: 'POST',\n description: 'Previews for up to 50 nodes; a node that cannot be shown answers unavailable.',\n body: json(Type.Object({ path: Path, nodeIds: Type.Array(Text, { maxItems: 50 }) })),\n responses: jsonApiResponses(Type.Object({ previews: Type.Record(Text, Preview) })),\n },\n ],\n});\n"],"mappings":";;;;;;;;;AAsBA,MAAa,yBAAyB;ACdtC,MAAa,mBAAmB;AAMhC,MAAa,4BAA4B;AACzC,MAAM,uBAAuB;AAE7B,MAAa,oBAAoB;;AAEjC,MAAa,2BAA2B;AAKxC,MAAa,uBAAuBA,QAAAA,KAAK,MAAM;CAACA,QAAAA,KAAK,QAAQ,MAAM;CAAGA,QAAAA,KAAK,QAAQ,MAAM;CAAGA,QAAAA,KAAK,QAAQ,UAAU;AAAC,CAAC;AACrH,MAAM,QAAQA,QAAAA,KAAK,OAAO;CAAE,GAAGA,QAAAA,KAAK,OAAO;CAAG,GAAGA,QAAAA,KAAK,OAAO;AAAE,CAAC;AAChE,MAAM,QAAQA,QAAAA,KAAK,OAAO,EAAE,WAAA,IAA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Q;GACR,aAAa;GACb,MAAM,KAAKF,QAAAA,KAAK,OAAO;IAAE,MAAM;IAAM,SAASA,QAAAA,KAAK,MAAM,MAAM,EAAE,UAAU,GAAG,CAAC;GAAE,CAAC,CAAC;GACnF,YAAA,GAAWE,gCAAAA,iBAAAA,CAAiBF,QAAAA,KAAK,OAAO,EAAE,UAAUA,QAAAA,KAAK,OAAO,MAAM,OAAO,EAAE,CAAC,CAAC;EACnF;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/schemas/apiContracts.d.ts
|
|
2
|
+
export declare const apiContracts: {
|
|
3
|
+
version: 1;
|
|
4
|
+
protocols?: Record<string, string> | undefined;
|
|
5
|
+
schemas?: Record<string, boolean | object> | undefined;
|
|
6
|
+
http: {
|
|
7
|
+
id: string;
|
|
8
|
+
scope: "host" | "session" | "workspace";
|
|
9
|
+
basePath?: string | undefined;
|
|
10
|
+
path: string;
|
|
11
|
+
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
12
|
+
description: string;
|
|
13
|
+
availability?: string | undefined;
|
|
14
|
+
authentication: "device" | "none" | "owner";
|
|
15
|
+
parameters?: {
|
|
16
|
+
name: string;
|
|
17
|
+
in: "header" | "path" | "query";
|
|
18
|
+
required: boolean;
|
|
19
|
+
schema: boolean | object;
|
|
20
|
+
}[] | undefined;
|
|
21
|
+
body?: {
|
|
22
|
+
contentType: string;
|
|
23
|
+
contentTypes?: string[] | undefined;
|
|
24
|
+
required: boolean;
|
|
25
|
+
schema: boolean | object;
|
|
26
|
+
} | undefined;
|
|
27
|
+
responses: Record<string, {
|
|
28
|
+
description: string;
|
|
29
|
+
contentType?: string | undefined;
|
|
30
|
+
schema?: boolean | object | undefined;
|
|
31
|
+
events?: Record<string, boolean | object> | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
}[];
|
|
34
|
+
sockets: {
|
|
35
|
+
id: string;
|
|
36
|
+
scope: "host" | "session" | "workspace";
|
|
37
|
+
description: string;
|
|
38
|
+
availability?: string | undefined;
|
|
39
|
+
service: string;
|
|
40
|
+
member: string;
|
|
41
|
+
direction: "client-to-server" | "server-to-client";
|
|
42
|
+
kind: "channel" | "method" | "state";
|
|
43
|
+
input: boolean | object;
|
|
44
|
+
output?: boolean | object | undefined;
|
|
45
|
+
errors?: boolean | object | undefined;
|
|
46
|
+
}[];
|
|
47
|
+
dynamic: string[];
|
|
48
|
+
gaps?: string[] | undefined;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { apiContracts as default };
|
|
52
|
+
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";qBAgCa"}
|