@crowdedkingdoms/crowdyjs 11.1.0 → 12.1.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/MIGRATION.md +152 -0
- package/README.md +262 -0
- package/dist/crowdy-agent/browser-dispatcher.d.ts +41 -0
- package/dist/crowdy-agent/browser-dispatcher.d.ts.map +1 -0
- package/dist/crowdy-agent/browser-dispatcher.js +264 -0
- package/dist/crowdy-agent/controller.d.ts +144 -0
- package/dist/crowdy-agent/controller.d.ts.map +1 -0
- package/dist/crowdy-agent/controller.js +1239 -0
- package/dist/crowdy-agent/errors.d.ts +37 -0
- package/dist/crowdy-agent/errors.d.ts.map +1 -0
- package/dist/crowdy-agent/errors.js +107 -0
- package/dist/crowdy-agent/graphql-transport.d.ts +154 -0
- package/dist/crowdy-agent/graphql-transport.d.ts.map +1 -0
- package/dist/crowdy-agent/graphql-transport.js +854 -0
- package/dist/crowdy-agent/index.d.ts +16 -0
- package/dist/crowdy-agent/index.d.ts.map +1 -0
- package/dist/crowdy-agent/index.js +15 -0
- package/dist/crowdy-agent/registry.d.ts +29 -0
- package/dist/crowdy-agent/registry.d.ts.map +1 -0
- package/dist/crowdy-agent/registry.js +281 -0
- package/dist/crowdy-agent/schema.d.ts +72 -0
- package/dist/crowdy-agent/schema.d.ts.map +1 -0
- package/dist/crowdy-agent/schema.js +467 -0
- package/dist/crowdy-agent/studio-tools.d.ts +15 -0
- package/dist/crowdy-agent/studio-tools.d.ts.map +1 -0
- package/dist/crowdy-agent/studio-tools.js +280 -0
- package/dist/crowdy-agent/tool-descriptors.d.ts +4 -0
- package/dist/crowdy-agent/tool-descriptors.d.ts.map +1 -0
- package/dist/crowdy-agent/tool-descriptors.js +1049 -0
- package/dist/crowdy-agent/transport.d.ts +152 -0
- package/dist/crowdy-agent/transport.d.ts.map +1 -0
- package/dist/crowdy-agent/transport.js +27 -0
- package/dist/crowdy-agent/types.d.ts +328 -0
- package/dist/crowdy-agent/types.d.ts.map +1 -0
- package/dist/crowdy-agent/types.js +37 -0
- package/dist/crowdy-client.d.ts +3 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +6 -0
- package/dist/crowdy-studio/agent-dom-shell.d.ts +68 -0
- package/dist/crowdy-studio/agent-dom-shell.d.ts.map +1 -0
- package/dist/crowdy-studio/agent-dom-shell.js +418 -0
- package/dist/crowdy-studio/controller.d.ts +74 -4
- package/dist/crowdy-studio/controller.d.ts.map +1 -1
- package/dist/crowdy-studio/controller.js +450 -17
- package/dist/crowdy-studio/dom-shell.d.ts +50 -4
- package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.js +554 -123
- package/dist/crowdy-studio/embed/dock.d.ts +56 -0
- package/dist/crowdy-studio/embed/dock.d.ts.map +1 -0
- package/dist/crowdy-studio/embed/dock.js +231 -0
- package/dist/crowdy-studio/embed/embed-styles.d.ts +12 -0
- package/dist/crowdy-studio/embed/embed-styles.d.ts.map +1 -0
- package/dist/crowdy-studio/embed/embed-styles.js +549 -0
- package/dist/crowdy-studio/embed/hud-layer.d.ts +40 -0
- package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -0
- package/dist/crowdy-studio/embed/hud-layer.js +100 -0
- package/dist/crowdy-studio/embed/index.d.ts +5 -0
- package/dist/crowdy-studio/embed/index.d.ts.map +1 -0
- package/dist/crowdy-studio/embed/index.js +4 -0
- package/dist/crowdy-studio/embed/panel.d.ts +162 -0
- package/dist/crowdy-studio/embed/panel.d.ts.map +1 -0
- package/dist/crowdy-studio/embed/panel.js +642 -0
- package/dist/crowdy-studio/index.d.ts +9 -3
- package/dist/crowdy-studio/index.d.ts.map +1 -1
- package/dist/crowdy-studio/index.js +6 -0
- package/dist/crowdy-studio/layout.d.ts +50 -0
- package/dist/crowdy-studio/layout.d.ts.map +1 -0
- package/dist/crowdy-studio/layout.js +155 -0
- package/dist/crowdy-studio/models.d.ts +67 -0
- package/dist/crowdy-studio/models.d.ts.map +1 -1
- package/dist/crowdy-studio/mount.d.ts +15 -0
- package/dist/crowdy-studio/mount.d.ts.map +1 -1
- package/dist/crowdy-studio/mount.js +132 -3
- package/dist/crowdy-studio/splitter.d.ts +33 -0
- package/dist/crowdy-studio/splitter.d.ts.map +1 -0
- package/dist/crowdy-studio/splitter.js +133 -0
- package/dist/crowdy-studio/styles.d.ts +1 -1
- package/dist/crowdy-studio/styles.d.ts.map +1 -1
- package/dist/crowdy-studio/styles.js +128 -11
- package/dist/generated/graphql.d.ts +3753 -1
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +296 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/player-host/control-banner.d.ts +40 -0
- package/dist/player-host/control-banner.d.ts.map +1 -0
- package/dist/player-host/control-banner.js +252 -0
- package/dist/player-host/control-gate.d.ts +77 -0
- package/dist/player-host/control-gate.d.ts.map +1 -0
- package/dist/player-host/control-gate.js +197 -0
- package/dist/player-host/index.d.ts +7 -0
- package/dist/player-host/index.d.ts.map +1 -0
- package/dist/player-host/index.js +5 -0
- package/dist/player-host/lease-manager.d.ts +66 -0
- package/dist/player-host/lease-manager.d.ts.map +1 -0
- package/dist/player-host/lease-manager.js +428 -0
- package/dist/player-host/schemas.d.ts +9 -0
- package/dist/player-host/schemas.d.ts.map +1 -0
- package/dist/player-host/schemas.js +347 -0
- package/dist/player-host/tools.d.ts +13 -0
- package/dist/player-host/tools.d.ts.map +1 -0
- package/dist/player-host/tools.js +79 -0
- package/dist/player-host/types.d.ts +203 -0
- package/dist/player-host/types.d.ts.map +1 -0
- package/dist/player-host/types.js +1 -0
- package/package.json +17 -2
|
@@ -7,3 +7,9 @@ export { isCurrentDiagnosticVersion, } from './monaco-editor.js';
|
|
|
7
7
|
export { EMBEDDED_PLATFORM_INDEX, MAX_PLATFORM_CRATES, MAX_PLATFORM_CRATE_FIELD_LENGTH, MAX_PLATFORM_INDEX_BYTES, computePlatformIndexContentHash, loadPlatformIndex, } from '../live-coding/platform-index.js';
|
|
8
8
|
export { DEFAULT_VFS_LIMITS, VfsLimitError, VirtualFileSystem, offsetAt, } from '../live-coding/vfs.js';
|
|
9
9
|
export { WorkerLanguageClient, WorkerMessageReader, WorkerMessageWriter, createDefaultRustLanguageWorker, } from '../live-coding/worker-transport.js';
|
|
10
|
+
export { CrowdyStudioAgentDomShell, } from './agent-dom-shell.js';
|
|
11
|
+
export { STUDIO_LAYOUT_STORAGE_KEY, STUDIO_PANE_IDS, StudioLayoutController, clampStudioPaneSize, studioPaneSizeRange, } from './layout.js';
|
|
12
|
+
export { createPaneSplitter, } from './splitter.js';
|
|
13
|
+
export * from './embed/index.js';
|
|
14
|
+
export * from '../crowdy-agent/index.js';
|
|
15
|
+
export * from '../player-host/index.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-directed Crowdy Studio layout state: which panes are visible and how
|
|
3
|
+
* large they are. The editor is the only always-visible surface; the explorer,
|
|
4
|
+
* project settings, agent dock, and bottom panel are toggled by the person
|
|
5
|
+
* using the Studio and their choices persist locally.
|
|
6
|
+
*/
|
|
7
|
+
export type StudioPaneId = 'explorer' | 'settings' | 'agent' | 'bottom';
|
|
8
|
+
export interface StudioPaneSizeRange {
|
|
9
|
+
readonly min: number;
|
|
10
|
+
readonly max: number;
|
|
11
|
+
}
|
|
12
|
+
export interface StudioLayoutState {
|
|
13
|
+
readonly visible: Readonly<Record<StudioPaneId, boolean>>;
|
|
14
|
+
/** Pixel widths for side panes; pixel height for the bottom panel. */
|
|
15
|
+
readonly sizes: Readonly<Record<StudioPaneId, number>>;
|
|
16
|
+
}
|
|
17
|
+
export type StudioLayoutListener = (state: StudioLayoutState) => void;
|
|
18
|
+
export type StudioLayoutStorage = Pick<Storage, 'getItem' | 'setItem'>;
|
|
19
|
+
export interface StudioLayoutControllerOptions {
|
|
20
|
+
storage?: StudioLayoutStorage | null;
|
|
21
|
+
storageKey?: string;
|
|
22
|
+
defaults?: Partial<StudioLayoutState>;
|
|
23
|
+
}
|
|
24
|
+
export declare const STUDIO_LAYOUT_STORAGE_KEY = "ck:crowdy-studio:layout:v1";
|
|
25
|
+
export declare const STUDIO_PANE_IDS: readonly StudioPaneId[];
|
|
26
|
+
export declare function studioPaneSizeRange(pane: StudioPaneId): StudioPaneSizeRange;
|
|
27
|
+
export declare function clampStudioPaneSize(pane: StudioPaneId, size: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Headless layout state machine. DOM shells subscribe and translate the state
|
|
30
|
+
* into CSS variables / hidden attributes; tests drive it directly.
|
|
31
|
+
*/
|
|
32
|
+
export declare class StudioLayoutController {
|
|
33
|
+
private readonly storage;
|
|
34
|
+
private readonly storageKey;
|
|
35
|
+
private readonly listeners;
|
|
36
|
+
private visible;
|
|
37
|
+
private sizes;
|
|
38
|
+
constructor(options?: StudioLayoutControllerOptions);
|
|
39
|
+
getState(): StudioLayoutState;
|
|
40
|
+
isVisible(pane: StudioPaneId): boolean;
|
|
41
|
+
paneSize(pane: StudioPaneId): number;
|
|
42
|
+
subscribe(listener: StudioLayoutListener): () => void;
|
|
43
|
+
setVisible(pane: StudioPaneId, visible: boolean): void;
|
|
44
|
+
toggle(pane: StudioPaneId): void;
|
|
45
|
+
setSize(pane: StudioPaneId, size: number, persist?: boolean): void;
|
|
46
|
+
private emit;
|
|
47
|
+
private loadPersisted;
|
|
48
|
+
private persist;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/layout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAExE,MAAM,WAAW,mBAAmB;IACl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EAAE,YAAY,GAAG,OAAO;IAItC,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM;IAIpC,SAAS,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI;IAOrD,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAOtD,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAIhC,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,UAAO,GAAG,IAAI;IAW/D,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,OAAO;CAWhB"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-directed Crowdy Studio layout state: which panes are visible and how
|
|
3
|
+
* large they are. The editor is the only always-visible surface; the explorer,
|
|
4
|
+
* project settings, agent dock, and bottom panel are toggled by the person
|
|
5
|
+
* using the Studio and their choices persist locally.
|
|
6
|
+
*/
|
|
7
|
+
export const STUDIO_LAYOUT_STORAGE_KEY = 'ck:crowdy-studio:layout:v1';
|
|
8
|
+
export const STUDIO_PANE_IDS = [
|
|
9
|
+
'explorer',
|
|
10
|
+
'settings',
|
|
11
|
+
'agent',
|
|
12
|
+
'bottom',
|
|
13
|
+
];
|
|
14
|
+
const DEFAULT_VISIBLE = {
|
|
15
|
+
explorer: true,
|
|
16
|
+
settings: false,
|
|
17
|
+
agent: false,
|
|
18
|
+
bottom: false,
|
|
19
|
+
};
|
|
20
|
+
const DEFAULT_SIZES = {
|
|
21
|
+
explorer: 230,
|
|
22
|
+
settings: 280,
|
|
23
|
+
agent: 340,
|
|
24
|
+
bottom: 180,
|
|
25
|
+
};
|
|
26
|
+
const SIZE_RANGES = {
|
|
27
|
+
explorer: { min: 160, max: 480 },
|
|
28
|
+
settings: { min: 220, max: 480 },
|
|
29
|
+
agent: { min: 280, max: 620 },
|
|
30
|
+
bottom: { min: 96, max: 480 },
|
|
31
|
+
};
|
|
32
|
+
export function studioPaneSizeRange(pane) {
|
|
33
|
+
return SIZE_RANGES[pane];
|
|
34
|
+
}
|
|
35
|
+
export function clampStudioPaneSize(pane, size) {
|
|
36
|
+
const range = SIZE_RANGES[pane];
|
|
37
|
+
if (!Number.isFinite(size))
|
|
38
|
+
return DEFAULT_SIZES[pane];
|
|
39
|
+
return Math.round(Math.min(range.max, Math.max(range.min, size)));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Headless layout state machine. DOM shells subscribe and translate the state
|
|
43
|
+
* into CSS variables / hidden attributes; tests drive it directly.
|
|
44
|
+
*/
|
|
45
|
+
export class StudioLayoutController {
|
|
46
|
+
constructor(options = {}) {
|
|
47
|
+
this.listeners = new Set();
|
|
48
|
+
this.storage =
|
|
49
|
+
options.storage !== undefined ? options.storage : safeLocalStorage();
|
|
50
|
+
this.storageKey = options.storageKey ?? STUDIO_LAYOUT_STORAGE_KEY;
|
|
51
|
+
this.visible = { ...DEFAULT_VISIBLE, ...options.defaults?.visible };
|
|
52
|
+
this.sizes = { ...DEFAULT_SIZES };
|
|
53
|
+
if (options.defaults?.sizes) {
|
|
54
|
+
for (const pane of STUDIO_PANE_IDS) {
|
|
55
|
+
const size = options.defaults.sizes[pane];
|
|
56
|
+
if (size !== undefined)
|
|
57
|
+
this.sizes[pane] = clampStudioPaneSize(pane, size);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
this.loadPersisted();
|
|
61
|
+
}
|
|
62
|
+
getState() {
|
|
63
|
+
return { visible: { ...this.visible }, sizes: { ...this.sizes } };
|
|
64
|
+
}
|
|
65
|
+
isVisible(pane) {
|
|
66
|
+
return this.visible[pane];
|
|
67
|
+
}
|
|
68
|
+
paneSize(pane) {
|
|
69
|
+
return this.sizes[pane];
|
|
70
|
+
}
|
|
71
|
+
subscribe(listener) {
|
|
72
|
+
this.listeners.add(listener);
|
|
73
|
+
return () => {
|
|
74
|
+
this.listeners.delete(listener);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
setVisible(pane, visible) {
|
|
78
|
+
if (this.visible[pane] === visible)
|
|
79
|
+
return;
|
|
80
|
+
this.visible = { ...this.visible, [pane]: visible };
|
|
81
|
+
this.persist();
|
|
82
|
+
this.emit();
|
|
83
|
+
}
|
|
84
|
+
toggle(pane) {
|
|
85
|
+
this.setVisible(pane, !this.visible[pane]);
|
|
86
|
+
}
|
|
87
|
+
setSize(pane, size, persist = true) {
|
|
88
|
+
const next = clampStudioPaneSize(pane, size);
|
|
89
|
+
if (this.sizes[pane] === next) {
|
|
90
|
+
if (persist)
|
|
91
|
+
this.persist();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.sizes = { ...this.sizes, [pane]: next };
|
|
95
|
+
if (persist)
|
|
96
|
+
this.persist();
|
|
97
|
+
this.emit();
|
|
98
|
+
}
|
|
99
|
+
emit() {
|
|
100
|
+
const state = this.getState();
|
|
101
|
+
for (const listener of [...this.listeners])
|
|
102
|
+
listener(state);
|
|
103
|
+
}
|
|
104
|
+
loadPersisted() {
|
|
105
|
+
if (!this.storage)
|
|
106
|
+
return;
|
|
107
|
+
let raw = null;
|
|
108
|
+
try {
|
|
109
|
+
raw = this.storage.getItem(this.storageKey);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!raw)
|
|
115
|
+
return;
|
|
116
|
+
try {
|
|
117
|
+
const parsed = JSON.parse(raw);
|
|
118
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
119
|
+
return;
|
|
120
|
+
const record = parsed;
|
|
121
|
+
for (const pane of STUDIO_PANE_IDS) {
|
|
122
|
+
const visible = record.visible?.[pane];
|
|
123
|
+
if (typeof visible === 'boolean')
|
|
124
|
+
this.visible[pane] = visible;
|
|
125
|
+
const size = record.sizes?.[pane];
|
|
126
|
+
if (typeof size === 'number' && Number.isFinite(size)) {
|
|
127
|
+
this.sizes[pane] = clampStudioPaneSize(pane, size);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Ignore corrupt persisted layout; defaults remain in effect.
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
persist() {
|
|
136
|
+
if (!this.storage)
|
|
137
|
+
return;
|
|
138
|
+
try {
|
|
139
|
+
this.storage.setItem(this.storageKey, JSON.stringify({ visible: this.visible, sizes: this.sizes }));
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// Storage can be unavailable (private mode); layout stays session-only.
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function safeLocalStorage() {
|
|
147
|
+
try {
|
|
148
|
+
if (typeof window === 'undefined')
|
|
149
|
+
return null;
|
|
150
|
+
return window.localStorage;
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -123,6 +123,73 @@ export interface CrowdyStudioProjectProvider {
|
|
|
123
123
|
importReferenceFile(input: ImportCrowdyStudioReferenceFileInput): Promise<CrowdyStudioProject>;
|
|
124
124
|
savePersonalLibraryFile(input: SaveCrowdyStudioLibraryFileInput): Promise<CrowdyStudioReferenceFile>;
|
|
125
125
|
}
|
|
126
|
+
export type CrowdyStudioPatchOperation = 'CREATE' | 'REPLACE';
|
|
127
|
+
/** One routine, non-destructive file replacement in an atomic agent patch. */
|
|
128
|
+
export interface CrowdyStudioAtomicFileChange {
|
|
129
|
+
target: CrowdyStudioTarget;
|
|
130
|
+
path: string;
|
|
131
|
+
operation: CrowdyStudioPatchOperation;
|
|
132
|
+
content: string;
|
|
133
|
+
/** `ABSENT` for CREATE, otherwise the exact current sha256 digest. */
|
|
134
|
+
expectedContentHash: string | 'ABSENT';
|
|
135
|
+
}
|
|
136
|
+
export interface CrowdyStudioAtomicPatchInput {
|
|
137
|
+
expectedRevisionId: string;
|
|
138
|
+
changes: readonly CrowdyStudioAtomicFileChange[];
|
|
139
|
+
}
|
|
140
|
+
export interface CrowdyStudioCheckpointFile {
|
|
141
|
+
target: CrowdyStudioTarget;
|
|
142
|
+
path: string;
|
|
143
|
+
contentHash: string;
|
|
144
|
+
byteLength: number;
|
|
145
|
+
}
|
|
146
|
+
/** Source-free checkpoint metadata safe for Studio state and agent events. */
|
|
147
|
+
export interface CrowdyStudioCheckpointMetadata {
|
|
148
|
+
checkpointId: string;
|
|
149
|
+
projectRevisionId: string;
|
|
150
|
+
contentHash: string;
|
|
151
|
+
reason: 'AGENT_WRITE' | 'RESTORE_PREIMAGE' | 'MANUAL';
|
|
152
|
+
files: readonly CrowdyStudioCheckpointFile[];
|
|
153
|
+
createdAt: string;
|
|
154
|
+
restoredAt?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface CrowdyStudioAtomicPatchResult {
|
|
157
|
+
project: CrowdyStudioProject;
|
|
158
|
+
checkpoint: CrowdyStudioCheckpointMetadata;
|
|
159
|
+
changedFiles: readonly CrowdyStudioCheckpointFile[];
|
|
160
|
+
}
|
|
161
|
+
export interface CrowdyStudioCheckpointRestoreInput {
|
|
162
|
+
projectId: string;
|
|
163
|
+
checkpointId: string;
|
|
164
|
+
expectedRevisionId: string;
|
|
165
|
+
/** Opaque single-use grant from the durable orchestrator. */
|
|
166
|
+
approvalGrant: string;
|
|
167
|
+
}
|
|
168
|
+
export interface CrowdyStudioCheckpointRestoreResult {
|
|
169
|
+
project: CrowdyStudioProject;
|
|
170
|
+
preRestoreCheckpoint: CrowdyStudioCheckpointMetadata;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Optional durable synchronization hooks. A generated Game API adapter can
|
|
174
|
+
* implement these after schema reconciliation; the headless kernel stays
|
|
175
|
+
* transport-neutral and tests can inject deterministic fakes.
|
|
176
|
+
*/
|
|
177
|
+
export interface CrowdyStudioSynchronizationProvider {
|
|
178
|
+
applyAtomicPatch(input: CrowdyStudioProjectScope & {
|
|
179
|
+
projectId: string;
|
|
180
|
+
expectedRevisionId: string;
|
|
181
|
+
changes: readonly CrowdyStudioAtomicFileChange[];
|
|
182
|
+
}): Promise<CrowdyStudioAtomicPatchResult>;
|
|
183
|
+
listCheckpoints(input: CrowdyStudioProjectScope & {
|
|
184
|
+
projectId: string;
|
|
185
|
+
}): Promise<readonly CrowdyStudioCheckpointMetadata[]>;
|
|
186
|
+
restoreCheckpoint(input: CrowdyStudioProjectScope & CrowdyStudioCheckpointRestoreInput): Promise<CrowdyStudioCheckpointRestoreResult>;
|
|
187
|
+
}
|
|
188
|
+
export interface CrowdyStudioProjectSynchronization {
|
|
189
|
+
source: 'AGENT' | 'REMOTE';
|
|
190
|
+
expectedPreviousRevisionId?: string;
|
|
191
|
+
checkpoint?: CrowdyStudioCheckpointMetadata;
|
|
192
|
+
}
|
|
126
193
|
/** Provider error indicating that the expected revision lost a save race. */
|
|
127
194
|
export declare class CrowdyStudioRevisionConflictError extends Error {
|
|
128
195
|
readonly remoteProject?: CrowdyStudioProject | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/models.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,4DAA4D;AAC5D,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE7E,8EAA8E;AAC9E,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,kBAAkB,GAAG,Q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BAG1C,OAAO,SAA2C,EACzC,aAAa,CAAC,EAAE,mBAAmB,YAAA;CAK/C;AAED,8EAA8E;AAC9E,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEb,OAAO,SAAmC,EAAE,KAAK,CAAC,EAAE,OAAO;CAKxE;AAED,6DAA6D;AAC7D,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa9D;AAED,yDAAyD;AACzD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,MAAM,GACX,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,MAAM,GACX,MAAM,CAOR;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,uBAAuB,GAAG,kBAAkB,EAAE,CAIlF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,mBAAmB,GAAG,mBAAmB,CAO1F"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { CrowdyStudioController, type CrowdyStudioControllerOptions } from './controller.js';
|
|
2
|
+
import { CrowdyAgentToolRegistry, CrowdyStudioAgentController, type CrowdyAgentBrowserToolHandlersV1, type CrowdyStudioAgentControllerOptionsV1 } from '../crowdy-agent/index.js';
|
|
3
|
+
import { AgentControlLeaseManager, type AgentControlLeaseManagerOptionsV1, type PlayerHostAdapterV1 } from '../player-host/index.js';
|
|
2
4
|
import type { CrowdyStudioEditorAdapter, CrowdyStudioEditorMode } from './editor.js';
|
|
3
5
|
import { type MonacoCrowdyStudioEditorOptions } from './monaco-editor.js';
|
|
4
6
|
export interface MountCrowdyStudioOptions extends CrowdyStudioControllerOptions, MonacoCrowdyStudioEditorOptions {
|
|
7
|
+
/** Optional durable Agentic Crowdy Studio vertical slice. */
|
|
8
|
+
agent?: MountCrowdyStudioAgentOptions;
|
|
9
|
+
}
|
|
10
|
+
export interface MountCrowdyStudioAgentOptions extends Omit<CrowdyStudioAgentControllerOptionsV1, 'browserDispatcher' | 'beforeAgentWork' | 'onEpochAttached' | 'onLeaseChanged' | 'onPreempt' | 'resolveProjectBinding'> {
|
|
11
|
+
registry?: CrowdyAgentToolRegistry;
|
|
12
|
+
/** Exact additional handlers, normally `game.extension.<game>.*`. */
|
|
13
|
+
browserHandlers?: CrowdyAgentBrowserToolHandlersV1;
|
|
14
|
+
playerHost?: PlayerHostAdapterV1;
|
|
15
|
+
controlGate?: AgentControlLeaseManagerOptionsV1;
|
|
16
|
+
onLocalPreempt?: CrowdyStudioAgentControllerOptionsV1['onPreempt'];
|
|
17
|
+
autoInitialize?: boolean;
|
|
5
18
|
}
|
|
6
19
|
export interface CrowdyStudioHandle {
|
|
7
20
|
controller: CrowdyStudioController;
|
|
21
|
+
agent: CrowdyStudioAgentController | null;
|
|
22
|
+
controlLeaseManager: AgentControlLeaseManager | null;
|
|
8
23
|
editorMode: CrowdyStudioEditorMode;
|
|
9
24
|
destroy(): void;
|
|
10
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,EACnC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,EACnC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGL,uBAAuB,EACvB,2BAA2B,EAE3B,KAAK,gCAAgC,EACrC,KAAK,oCAAoC,EAC1C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,wBAAwB,EAExB,KAAK,iCAAiC,EACtC,KAA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.js';
|
|
2
|
+
import { CROWDY_AGENT_TOOL_REGISTRY_V1, CrowdyAgentBrowserToolDispatcher, CrowdyStudioAgentController, createCrowdyStudioAgentTools, } from '../crowdy-agent/index.js';
|
|
3
|
+
import { createPlayerHostAgentTools, } from '../player-host/index.js';
|
|
2
4
|
import { CrowdyStudioDomShell } from './dom-shell.js';
|
|
3
5
|
import { createMonacoCrowdyStudioEditor, } from './monaco-editor.js';
|
|
4
6
|
import { createTextareaCrowdyStudioEditor } from './textarea-editor.js';
|
|
@@ -41,11 +43,104 @@ export async function mountCrowdyStudio(host, options) {
|
|
|
41
43
|
throw new Error('mountCrowdyStudio requires a DOM document');
|
|
42
44
|
}
|
|
43
45
|
const controller = new CrowdyStudioController(options);
|
|
44
|
-
|
|
46
|
+
let agent = null;
|
|
47
|
+
let controlLeaseManager = null;
|
|
48
|
+
if (options.agent) {
|
|
49
|
+
const registry = options.agent.registry ?? CROWDY_AGENT_TOOL_REGISTRY_V1;
|
|
50
|
+
const hostTools = options.agent.playerHost
|
|
51
|
+
? createPlayerHostAgentTools(options.agent.playerHost, {
|
|
52
|
+
...options.agent.controlGate,
|
|
53
|
+
contextVersion: options.agent.controlGate?.contextVersion ??
|
|
54
|
+
(() => agent?.getState().session?.contextVersion ??
|
|
55
|
+
controller.getAgentContext().contextVersion),
|
|
56
|
+
})
|
|
57
|
+
: null;
|
|
58
|
+
controlLeaseManager = hostTools?.leaseManager ?? null;
|
|
59
|
+
const handlers = mergeAgentHandlers(createCrowdyStudioAgentTools(controller, {
|
|
60
|
+
getClientEpoch: () => agent?.getState().clientEpoch ?? null,
|
|
61
|
+
getContextVersion: () => agent?.getState().session?.contextVersion,
|
|
62
|
+
getLeaseKinds: () => agent
|
|
63
|
+
?.getState()
|
|
64
|
+
.leases.filter((lease) => lease.status === 'ACTIVE')
|
|
65
|
+
.map((lease) => lease.kind) ?? [],
|
|
66
|
+
getHostCapabilityRevision: () => controlLeaseManager?.snapshot().capabilities?.revision,
|
|
67
|
+
isLeaseActive: (leaseId, kind) => agent
|
|
68
|
+
?.getState()
|
|
69
|
+
.leases.some((lease) => lease.leaseId === leaseId &&
|
|
70
|
+
lease.kind === kind &&
|
|
71
|
+
lease.status === 'ACTIVE') ?? false,
|
|
72
|
+
}), hostTools?.handlers, options.agent.browserHandlers);
|
|
73
|
+
const dispatcher = new CrowdyAgentBrowserToolDispatcher({
|
|
74
|
+
registry,
|
|
75
|
+
handlers,
|
|
76
|
+
getSessionId: () => agent?.getState().session?.sessionId ?? null,
|
|
77
|
+
getClientEpoch: () => agent?.getState().clientEpoch ?? null,
|
|
78
|
+
getContextVersion: () => agent?.getState().session?.contextVersion ??
|
|
79
|
+
controller.getAgentContext().contextVersion,
|
|
80
|
+
getMode: () => agent?.getState().session?.mode ?? 'ASK',
|
|
81
|
+
});
|
|
82
|
+
const agentOptions = options.agent;
|
|
83
|
+
agent = new CrowdyStudioAgentController({
|
|
84
|
+
...agentOptions,
|
|
85
|
+
browserDispatcher: dispatcher,
|
|
86
|
+
resolveProjectBinding: async () => {
|
|
87
|
+
const project = controller.getState().project;
|
|
88
|
+
if (project && !(await controller.saveNow())) {
|
|
89
|
+
throw new Error('Resolve the selected project save before starting the agent');
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
...(project ? { projectId: project.projectId } : {}),
|
|
93
|
+
gridId: project?.gridId ?? options.gridId,
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
beforeAgentWork: async () => {
|
|
97
|
+
await controller.prepareForAgentWork();
|
|
98
|
+
},
|
|
99
|
+
onPreempt: (reason) => {
|
|
100
|
+
controlLeaseManager?.preempt(reason);
|
|
101
|
+
agentOptions.onLocalPreempt?.(reason);
|
|
102
|
+
},
|
|
103
|
+
onEpochAttached: (clientEpoch) => {
|
|
104
|
+
controlLeaseManager?.attach(clientEpoch);
|
|
105
|
+
if (controlLeaseManager) {
|
|
106
|
+
void controlLeaseManager.refreshCapabilities().catch(() => {
|
|
107
|
+
controlLeaseManager?.preempt('CONTEXT_CHANGED');
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
onLeaseChanged: (lease) => {
|
|
112
|
+
if (!controlLeaseManager || lease.kind !== 'PLAY')
|
|
113
|
+
return;
|
|
114
|
+
if (lease.status === 'ACTIVE') {
|
|
115
|
+
void controlLeaseManager
|
|
116
|
+
.refreshCapabilities()
|
|
117
|
+
.then(() => controlLeaseManager?.grantLease(lease))
|
|
118
|
+
.catch(() => controlLeaseManager?.preempt('CONTEXT_CHANGED'));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
controlLeaseManager.preempt(lease.revokedReason ?? 'LEASE_EXPIRED');
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const shell = new CrowdyStudioDomShell(host, controller, agent ?? undefined, {
|
|
127
|
+
getPlayLeaseContext: () => {
|
|
128
|
+
const capabilities = controlLeaseManager?.snapshot().capabilities;
|
|
129
|
+
return capabilities
|
|
130
|
+
? {
|
|
131
|
+
controlledEntityId: capabilities.controlledEntityId,
|
|
132
|
+
hostCapabilityRevision: capabilities.revision,
|
|
133
|
+
}
|
|
134
|
+
: null;
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
const unsubscribeHumanEdit = controller.onHumanEdit(() => agent?.preemptForHumanEdit());
|
|
45
138
|
let editor = null;
|
|
46
139
|
let destroyed = false;
|
|
47
140
|
let recoveringEditor = false;
|
|
48
|
-
|
|
141
|
+
// Observe the editor box itself so pane toggles and splitter drags inside
|
|
142
|
+
// the studio relayout Monaco, not only host/window resizes.
|
|
143
|
+
const disconnectLayoutObserver = observeCrowdyStudioEditorLayout(shell.editorHost, () => editor);
|
|
49
144
|
const callbacks = {
|
|
50
145
|
onProjectFileChange: (target, path, content) => controller.updateFile(target, path, content),
|
|
51
146
|
onLocalDiagnostics: (diagnostics) => controller.setLocalDiagnostics(diagnostics),
|
|
@@ -68,12 +163,20 @@ export async function mountCrowdyStudio(host, options) {
|
|
|
68
163
|
});
|
|
69
164
|
},
|
|
70
165
|
};
|
|
166
|
+
let selectedProjectId = controller.getState().project?.projectId;
|
|
71
167
|
const unsubscribe = controller.subscribe((state) => {
|
|
72
168
|
shell.render(state);
|
|
73
169
|
editor?.sync(state);
|
|
170
|
+
const nextProjectId = state.project?.projectId;
|
|
171
|
+
if (nextProjectId !== selectedProjectId) {
|
|
172
|
+
selectedProjectId = nextProjectId;
|
|
173
|
+
agent?.projectSelectionChanged(nextProjectId);
|
|
174
|
+
}
|
|
74
175
|
});
|
|
75
176
|
const onVisibilityChange = () => {
|
|
76
|
-
|
|
177
|
+
const visible = document.visibilityState !== 'hidden';
|
|
178
|
+
controller.setPageVisible(visible);
|
|
179
|
+
agent?.setPageVisible(visible);
|
|
77
180
|
};
|
|
78
181
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
79
182
|
onVisibilityChange();
|
|
@@ -88,6 +191,11 @@ export async function mountCrowdyStudio(host, options) {
|
|
|
88
191
|
}
|
|
89
192
|
editor.sync(controller.getState());
|
|
90
193
|
editor.layout();
|
|
194
|
+
if (agent && options.agent?.autoInitialize !== false) {
|
|
195
|
+
await agent.initialize().catch((error) => {
|
|
196
|
+
console.warn('Crowdy Studio agent could not attach; manual Studio remains available', error);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
91
199
|
}
|
|
92
200
|
catch (error) {
|
|
93
201
|
disconnectLayoutObserver();
|
|
@@ -96,11 +204,15 @@ export async function mountCrowdyStudio(host, options) {
|
|
|
96
204
|
const failedEditor = editor;
|
|
97
205
|
failedEditor?.dispose();
|
|
98
206
|
shell.dispose();
|
|
207
|
+
unsubscribeHumanEdit();
|
|
208
|
+
agent?.destroy();
|
|
99
209
|
controller.destroy();
|
|
100
210
|
throw error;
|
|
101
211
|
}
|
|
102
212
|
return {
|
|
103
213
|
controller,
|
|
214
|
+
agent,
|
|
215
|
+
controlLeaseManager,
|
|
104
216
|
get editorMode() {
|
|
105
217
|
return editor?.mode ?? 'textarea';
|
|
106
218
|
},
|
|
@@ -114,7 +226,24 @@ export async function mountCrowdyStudio(host, options) {
|
|
|
114
226
|
editor?.dispose();
|
|
115
227
|
editor = null;
|
|
116
228
|
shell.dispose();
|
|
229
|
+
unsubscribeHumanEdit();
|
|
230
|
+
agent?.destroy();
|
|
231
|
+
agent = null;
|
|
117
232
|
controller.destroy();
|
|
118
233
|
},
|
|
119
234
|
};
|
|
120
235
|
}
|
|
236
|
+
function mergeAgentHandlers(...sets) {
|
|
237
|
+
const merged = {};
|
|
238
|
+
for (const set of sets) {
|
|
239
|
+
if (!set)
|
|
240
|
+
continue;
|
|
241
|
+
for (const [name, handler] of Object.entries(set)) {
|
|
242
|
+
if (merged[name]) {
|
|
243
|
+
throw new Error(`Duplicate Crowdy Studio browser tool handler: ${name}`);
|
|
244
|
+
}
|
|
245
|
+
merged[name] = handler;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return Object.freeze(merged);
|
|
249
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable accessible pane splitter for Crowdy Studio panes. Pointer drag plus
|
|
3
|
+
* Arrow/Home/End keyboard resizing, mirroring the behavior games already ship
|
|
4
|
+
* for the game/studio dock separator.
|
|
5
|
+
*/
|
|
6
|
+
export interface PaneSplitterRange {
|
|
7
|
+
readonly min: number;
|
|
8
|
+
readonly max: number;
|
|
9
|
+
}
|
|
10
|
+
export interface PaneSplitterOptions {
|
|
11
|
+
/** `vertical` separators resize widths; `horizontal` separators heights. */
|
|
12
|
+
orientation: 'vertical' | 'horizontal';
|
|
13
|
+
/**
|
|
14
|
+
* Where the sized pane sits relative to the separator in document order:
|
|
15
|
+
* `before` (explorer to its left / panel above) grows as the pointer moves
|
|
16
|
+
* right/down; `after` (right-hand or bottom panes) grows in the opposite
|
|
17
|
+
* direction.
|
|
18
|
+
*/
|
|
19
|
+
pane: 'before' | 'after';
|
|
20
|
+
label: string;
|
|
21
|
+
range(): PaneSplitterRange;
|
|
22
|
+
getSize(): number;
|
|
23
|
+
/** `commit` is true for the final size of a gesture (persist it). */
|
|
24
|
+
setSize(size: number, commit: boolean): void;
|
|
25
|
+
}
|
|
26
|
+
export interface PaneSplitterHandle {
|
|
27
|
+
readonly element: HTMLDivElement;
|
|
28
|
+
/** Re-sync ARIA values after external size or range changes. */
|
|
29
|
+
refresh(): void;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
32
|
+
export declare function createPaneSplitter(options: PaneSplitterOptions): PaneSplitterHandle;
|
|
33
|
+
//# sourceMappingURL=splitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitter.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/splitter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,WAAW,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC;;;;;OAKG;IACH,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,IAAI,iBAAiB,CAAC;IAC3B,OAAO,IAAI,MAAM,CAAC;IAClB,qEAAqE;IACrE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,gEAAgE;IAChE,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,IAAI,IAAI,CAAC;CACjB;AAKD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,mBAAmB,GAC3B,kBAAkB,CAoIpB"}
|