@jarenjs/studio 0.83.3 → 0.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -6
- package/contracts/data.contract.json +243 -0
- package/dist/types/component/data/actions.d.ts +234 -0
- package/dist/types/component/data/index.d.ts +9 -0
- package/dist/types/component/data/mount.d.ts +87 -0
- package/dist/types/component/data/project-widget.d.ts +27 -0
- package/dist/types/component/data/viewmodel.d.ts +85 -0
- package/dist/types/component/data/views.d.ts +148 -0
- package/dist/types/component/document.d.ts +82 -0
- package/dist/types/component/flow/actions.d.ts +708 -0
- package/dist/types/component/flow/index.d.ts +7 -0
- package/dist/types/component/flow/mount.d.ts +66 -0
- package/dist/types/component/flow/project-widget.d.ts +8 -0
- package/dist/types/component/flow/runtime.d.ts +57 -0
- package/dist/types/component/flow/views.d.ts +242 -0
- package/dist/types/component/host.d.ts +2 -2
- package/dist/types/component/index.d.ts +21 -15
- package/dist/types/component/mount.d.ts +51 -0
- package/dist/types/component/project-actions.d.ts +302 -0
- package/dist/types/component/project-controller.d.ts +81 -0
- package/dist/types/component/project-state.d.ts +1 -0
- package/dist/types/component/project.d.ts +327 -0
- package/dist/types/component/shared/host-widget.d.ts +24 -0
- package/dist/types/component/shared/memo.d.ts +12 -0
- package/dist/types/component/shared/nodes.d.ts +92 -0
- package/dist/types/component/shared/schema-options.d.ts +28 -0
- package/dist/types/component/shared/studio-kit.d.ts +78 -0
- package/dist/types/component/shared/ui.d.ts +136 -0
- package/dist/types/component/view.d.ts +6 -6
- package/dist/types/data/boot-stages.d.ts +97 -0
- package/dist/types/data/browser-worker.d.ts +22 -0
- package/dist/types/data/contract.d.ts +9 -0
- package/dist/types/data/editor.d.ts +81 -0
- package/dist/types/data/handlers.d.ts +130 -0
- package/dist/types/data/host.d.ts +8 -0
- package/dist/types/data/project-worker.d.ts +8 -0
- package/dist/types/data/runtime.d.ts +46 -0
- package/dist/types/data/state.d.ts +33 -0
- package/dist/types/data/storage.d.ts +26 -0
- package/dist/types/data/transport.d.ts +69 -0
- package/dist/types/flow-document.d.ts +19 -0
- package/dist/types/flow-editor.d.ts +88 -0
- package/docs/EDITORS.md +158 -0
- package/docs/PROJECT-FORMAT.md +1 -11
- package/package.json +32 -15
- package/src/component/data/actions.js +138 -0
- package/src/component/data/index.js +10 -0
- package/src/component/data/mount.js +63 -0
- package/src/component/data/project-widget.js +164 -0
- package/src/component/data/viewmodel.js +185 -0
- package/src/component/data/views.js +241 -0
- package/src/component/document.js +344 -0
- package/src/component/flow/actions.js +331 -0
- package/src/component/flow/index.js +8 -0
- package/src/component/flow/mount.js +53 -0
- package/src/component/flow/project-widget.js +44 -0
- package/src/component/flow/runtime.js +481 -0
- package/src/component/flow/views.js +196 -0
- package/src/component/host.js +2 -2
- package/src/component/index.js +19 -9
- package/src/component/mount.js +43 -0
- package/src/component/project-actions.js +189 -0
- package/src/component/project-controller.js +248 -0
- package/src/component/project-state.js +30 -0
- package/src/component/project.js +308 -0
- package/src/component/shared/host-widget.js +35 -0
- package/src/component/shared/memo.js +28 -0
- package/src/component/shared/nodes.js +94 -0
- package/src/component/shared/schema-options.js +30 -0
- package/src/component/shared/studio-kit.js +59 -0
- package/src/component/shared/ui.js +134 -0
- package/src/data/boot-stages.js +202 -0
- package/src/data/browser-worker.js +247 -0
- package/src/data/contract.js +7 -0
- package/src/data/editor.js +95 -0
- package/src/data/handlers.js +349 -0
- package/src/data/host.js +8 -0
- package/src/data/project-worker.js +26 -0
- package/src/data/runtime.js +462 -0
- package/src/data/state.js +46 -0
- package/src/data/storage.js +61 -0
- package/src/data/transport.js +215 -0
- package/src/flow-document.js +24 -0
- package/src/flow-editor.js +98 -0
- package/styles/data.css +53 -0
- package/styles/editor.css +150 -0
- package/styles/flow.css +99 -0
- package/styles/studio.css +1 -0
- package/dist/types/author.d.ts +0 -27
- package/src/author.js +0 -55
package/dist/types/author.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const AUTHORABLE_KINDS: readonly string[];
|
|
2
|
-
/** @param {{ client: any, operators?: any, maxRepairs?: number }} options */
|
|
3
|
-
export declare function createStudioFileAuthor(options: {
|
|
4
|
-
client: any;
|
|
5
|
-
operators?: any;
|
|
6
|
-
maxRepairs?: number;
|
|
7
|
-
}): {
|
|
8
|
-
/** @param {{ project: any, name: string, kind?: string, prompt: string }} request
|
|
9
|
-
* @param {{ signal?: AbortSignal }} [hooks] */
|
|
10
|
-
author(request: {
|
|
11
|
-
project: any;
|
|
12
|
-
name: string;
|
|
13
|
-
kind?: string;
|
|
14
|
-
prompt: string;
|
|
15
|
-
}, hooks?: {
|
|
16
|
-
signal?: AbortSignal;
|
|
17
|
-
}): Promise<{
|
|
18
|
-
errors: any[];
|
|
19
|
-
raw: string;
|
|
20
|
-
attempts: number;
|
|
21
|
-
} | {
|
|
22
|
-
value: any;
|
|
23
|
-
raw: string;
|
|
24
|
-
attempts: number;
|
|
25
|
-
file: any;
|
|
26
|
-
}>;
|
|
27
|
-
};
|
package/src/author.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//@ts-check
|
|
2
|
-
/** Constrain one file's generation, then apply the full grammar/compiler.
|
|
3
|
-
* This helper returns a candidate; the host owns conflict-safe publication. */
|
|
4
|
-
import { createStructuredOutput } from '@jarenjs/ai';
|
|
5
|
-
import { validateFile } from './validate.js';
|
|
6
|
-
import { resolveProjectFile } from './resolve.js';
|
|
7
|
-
import app from '@jarenjs/app/schemas/jaren-app.authoring.schema.json' with { type: 'json' };
|
|
8
|
-
import query from '@jarenjs/json/schemas/jaren-query.authoring.schema.json' with { type: 'json' };
|
|
9
|
-
import jslt from '@jarenjs/json/schemas/jaren-jslt.authoring.schema.json' with { type: 'json' };
|
|
10
|
-
import fsm from '@jarenjs/flow/schemas/jaren-fsm.authoring.schema.json' with { type: 'json' };
|
|
11
|
-
import dag from '@jarenjs/flow/schemas/jaren-dag.authoring.schema.json' with { type: 'json' };
|
|
12
|
-
import model from '@jarenjs/db/schemas/jaren-model.authoring.schema.json' with { type: 'json' };
|
|
13
|
-
|
|
14
|
-
export const AUTHORABLE_KINDS = Object.freeze(['app', 'query', 'jslt', 'fsm', 'dag', 'model', 'schema', 'state', 'data', 'contract']);
|
|
15
|
-
const PROFILES = { app, query, jslt, fsm, dag, model,
|
|
16
|
-
schema: { anyOf: [{ type: 'object' }, { type: 'boolean' }] },
|
|
17
|
-
state: {}, data: {}, contract: { type: 'object' },
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/** @param {{ client: any, operators?: any, maxRepairs?: number }} options */
|
|
21
|
-
export function createStudioFileAuthor(options) {
|
|
22
|
-
return {
|
|
23
|
-
/** @param {{ project: any, name: string, kind?: string, prompt: string }} request
|
|
24
|
-
* @param {{ signal?: AbortSignal }} [hooks] */
|
|
25
|
-
async author(request, hooks = {}) {
|
|
26
|
-
const original = request.project.files.find((f) => f.name === request.name);
|
|
27
|
-
const kind = request.kind ?? original?.kind;
|
|
28
|
-
if (!AUTHORABLE_KINDS.includes(kind)) throw new TypeError('choose an authorable file kind');
|
|
29
|
-
// Imported destinations are authored as fragments, never expanded into
|
|
30
|
-
// duplicated members. Their assembled artifact is the acceptance gate.
|
|
31
|
-
const profile = original?.imports ? { type: 'object' } : PROFILES[kind];
|
|
32
|
-
const check = (doc) => {
|
|
33
|
-
try {
|
|
34
|
-
const file = { ...original, name: request.name, kind, text: JSON.stringify(doc) };
|
|
35
|
-
const project = { files: [...request.project.files.filter((f) => f.name !== file.name), file] };
|
|
36
|
-
const assembled = resolveProjectFile(project, file.name).doc;
|
|
37
|
-
const verdict = validateFile({ ...file, text: JSON.stringify(assembled) }, { operators: options.operators });
|
|
38
|
-
if (!verdict.valid) return verdict;
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
catch (error) { return { valid: false, errors: [{ code: error.code ?? null,
|
|
42
|
-
docPath: error.docPath ?? '', message: error.reason ?? error.message }] }; }
|
|
43
|
-
};
|
|
44
|
-
const generator = createStructuredOutput({ client: options.client, schema: profile,
|
|
45
|
-
name: `studio_${kind}`, strict: false, validator: check, maxRepairs: options.maxRepairs ?? 2 });
|
|
46
|
-
const result = await generator.generate([
|
|
47
|
-
{ role: 'system', content: `Author exactly one ${kind} file named ${request.name}. Return its JSON value only. Do not return a project envelope. Files available: ${JSON.stringify(request.project.files.map((f) => ({ name: f.name, kind: f.kind })))}.${original?.imports ? ` Imported members are supplied by ${JSON.stringify(original.imports)}; omit these members from your output.` : ''}` },
|
|
48
|
-
...(original ? [{ role: 'user', content: `Current file:\n${original.text}` }] : []),
|
|
49
|
-
{ role: 'user', content: request.prompt },
|
|
50
|
-
], hooks);
|
|
51
|
-
if (!('value' in result)) return result;
|
|
52
|
-
return { ...result, file: { ...original, name: request.name, kind, text: JSON.stringify(result.value, null, 2) } };
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|