@iniesta8888/agent-live-dsh-adapter 0.3.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 +23 -0
- package/cordis.patch.yml +3 -0
- package/lib/client.js +539 -0
- package/lib/index.js +1342 -0
- package/lib/types/dsh/src/adapter.d.ts +53 -0
- package/lib/types/dsh/src/client.d.ts +4 -0
- package/lib/types/dsh/src/creator.d.ts +14 -0
- package/lib/types/dsh/src/frame-runtime.d.ts +1046 -0
- package/lib/types/dsh/src/index.d.ts +4 -0
- package/lib/types/src/content/compiler.d.ts +30 -0
- package/lib/types/src/content/graph-validator.d.ts +55 -0
- package/lib/types/src/content/library.d.ts +3 -0
- package/lib/types/src/content/registry.d.ts +33 -0
- package/lib/types/src/content/runtime-content.d.ts +62 -0
- package/lib/types/src/content/schema.d.ts +141 -0
- package/lib/types/src/content/validator.d.ts +34 -0
- package/lib/types/src/core/limits.d.ts +14 -0
- package/lib/types/src/core/mapping.d.ts +16 -0
- package/lib/types/src/core/protocol.d.ts +104 -0
- package/lib/types/src/creator/commands.d.ts +18 -0
- package/lib/types/src/creator/mode.d.ts +9 -0
- package/lib/types/src/creator/service.d.ts +198 -0
- package/lib/types/src/runtime/content-service.d.ts +74 -0
- package/package.json +89 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type OfficeSpec } from "./schema.ts";
|
|
2
|
+
import { type ComponentLibraryView, type ValidationIssue } from "./validator.ts";
|
|
3
|
+
export interface CompileAdjustment {
|
|
4
|
+
code: string;
|
|
5
|
+
path: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CompileResult {
|
|
9
|
+
draft?: OfficeSpec;
|
|
10
|
+
errors: ValidationIssue[];
|
|
11
|
+
adjustments: CompileAdjustment[];
|
|
12
|
+
}
|
|
13
|
+
/** The common compilation gate used by both Official and Custom Office Specs. */
|
|
14
|
+
export declare function compileOfficeSpec(input: unknown, library: ComponentLibraryView): CompileResult;
|
|
15
|
+
/**
|
|
16
|
+
* Creates the smallest valid custom office around a registered room.
|
|
17
|
+
* Internal primitive: Creator never starts from an empty room, it edits the
|
|
18
|
+
* Preset Office that already owns the room (see CreatorService.customize).
|
|
19
|
+
*/
|
|
20
|
+
export declare function compileOfficeSeed(input: unknown, library: ComponentLibraryView): CompileResult;
|
|
21
|
+
/**
|
|
22
|
+
* The id a patch targets when it does not name one: a Custom Office keeps its
|
|
23
|
+
* identity, a Preset Office is copied into its single editable local Office.
|
|
24
|
+
*/
|
|
25
|
+
export declare function patchOfficeId(base: OfficeSpec): string;
|
|
26
|
+
/** The Preset a `local/<preset>` Office id is reserved for. */
|
|
27
|
+
export declare function presetIdForLocalId(localId: string): string | undefined;
|
|
28
|
+
/** The Preset an Office descends from; an official Office is its own Preset. */
|
|
29
|
+
export declare function ownerPresetId(base: OfficeSpec): string | undefined;
|
|
30
|
+
export declare function compileOfficePatch(base: OfficeSpec, patchInput: unknown, library: ComponentLibraryView): CompileResult;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural rules for a renderable content graph — the single source of truth.
|
|
3
|
+
*
|
|
4
|
+
* Two consumers share this module:
|
|
5
|
+
* - the browser imports the generated `web/v2/graph-validator.js`
|
|
6
|
+
* (see `tsconfig.web-validator.json` and `scripts/web-validator.mjs`);
|
|
7
|
+
* - the local server imports the TypeScript module directly, so the same rules
|
|
8
|
+
* gate saving an Office Spec and serving `/api/office-content`.
|
|
9
|
+
*
|
|
10
|
+
* Keep this file dependency-free, platform-neutral, and side-effect-free: it is
|
|
11
|
+
* compiled for the browser and bundled into every host integration.
|
|
12
|
+
*/
|
|
13
|
+
/** Capabilities every layout must expose as a walkable work station. */
|
|
14
|
+
export declare const WORK_CAPABILITIES: readonly ["research", "create", "compute", "plan", "communicate", "collaborate"];
|
|
15
|
+
/** Renderer-resolved destinations that deliberately do not belong to a layout. */
|
|
16
|
+
export declare const DYNAMIC_ACTIVITY_TARGETS: Set<string>;
|
|
17
|
+
export interface ContentIssue {
|
|
18
|
+
code: string;
|
|
19
|
+
path: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What an activity needs to be staged: a named prop instance, or a capability
|
|
24
|
+
* any matching prop type can provide. The named form is the legacy syntax;
|
|
25
|
+
* capability requirements let the same implementation be reused across layouts
|
|
26
|
+
* and stop a prop swap from satisfying an activity by id alone.
|
|
27
|
+
*/
|
|
28
|
+
export type ActivityRequirement = string | {
|
|
29
|
+
prop: string;
|
|
30
|
+
} | {
|
|
31
|
+
capability: string;
|
|
32
|
+
};
|
|
33
|
+
export interface ResolvedRequirements {
|
|
34
|
+
/** Resolved instance id per requirement, aligned by index; null when unresolved. */
|
|
35
|
+
bindings: (string | null)[];
|
|
36
|
+
issues: ContentIssue[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolves activity requirements against the props actually present, so both
|
|
40
|
+
* syntaxes stay valid while content migrates.
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveActivityRequirements(requires: readonly unknown[] | undefined, instances: Iterable<readonly [string, string]>, capabilitiesOf: (type: string) => readonly string[], activity: string): ResolvedRequirements;
|
|
43
|
+
export declare function assertManifest(value: unknown, kind: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Layout structure rules. `propTypeNames` are the type names a layout may
|
|
46
|
+
* reference; the library stores props namespaced while the rendered graph does
|
|
47
|
+
* not, so both callers normalize before calling.
|
|
48
|
+
*/
|
|
49
|
+
export declare function layoutIssues(layout: any, propTypeNames: Iterable<string>): ContentIssue[];
|
|
50
|
+
/** Every reason the browser would refuse to render this resolved content graph. */
|
|
51
|
+
export declare function graphIssues(content: any): ContentIssue[];
|
|
52
|
+
/** Browser entry point: refuse the first structural problem, exactly as rendered. */
|
|
53
|
+
export declare function validateRegistry(content: unknown): void;
|
|
54
|
+
/** Server entry point: report every problem at once for the Creator surface. */
|
|
55
|
+
export declare function graphIssueMessages(content: unknown): string[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import type { OfficeSpec } from "./schema.ts";
|
|
3
|
+
import { type ComponentLibraryView, type ValidationIssue } from "./validator.ts";
|
|
4
|
+
export interface RegistryEntry {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
origin: "official" | "custom";
|
|
8
|
+
selected: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface SaveResult {
|
|
11
|
+
saved: boolean;
|
|
12
|
+
issues: ValidationIssue[];
|
|
13
|
+
}
|
|
14
|
+
export interface OfficeRegistryOptions {
|
|
15
|
+
root: string;
|
|
16
|
+
library: ComponentLibraryView;
|
|
17
|
+
officialOffices: OfficeSpec[];
|
|
18
|
+
fallbackOffice?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class OfficeRegistry {
|
|
21
|
+
#private;
|
|
22
|
+
readonly root: string;
|
|
23
|
+
constructor(options: OfficeRegistryOptions);
|
|
24
|
+
onChange(listener: (id: string | undefined) => void): () => EventEmitter<[never]>;
|
|
25
|
+
initialize(): Promise<void>;
|
|
26
|
+
list(): Promise<RegistryEntry[]>;
|
|
27
|
+
get(id: string): Promise<OfficeSpec | undefined>;
|
|
28
|
+
save(spec: OfficeSpec): Promise<SaveResult>;
|
|
29
|
+
remove(id: string): Promise<boolean>;
|
|
30
|
+
select(id: string): Promise<void>;
|
|
31
|
+
selectedId(): Promise<string>;
|
|
32
|
+
selected(): Promise<OfficeSpec>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { OfficeSpec } from "./schema.ts";
|
|
2
|
+
import type { ComponentLibraryView } from "./validator.ts";
|
|
3
|
+
/** Compiles a validated Office Spec into the renderer's current in-memory content graph. */
|
|
4
|
+
export declare function resolveRuntimeContent(spec: OfficeSpec, contentRoot: string, library: ComponentLibraryView): Promise<{
|
|
5
|
+
preset: Record<string, unknown>;
|
|
6
|
+
style: any;
|
|
7
|
+
layout: any;
|
|
8
|
+
agentSkin: any;
|
|
9
|
+
agentProfile: {
|
|
10
|
+
appearance: any;
|
|
11
|
+
title?: string | undefined;
|
|
12
|
+
name?: string | undefined;
|
|
13
|
+
template: any;
|
|
14
|
+
};
|
|
15
|
+
props: {
|
|
16
|
+
schemaVersion: number;
|
|
17
|
+
kind: string;
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
version: string;
|
|
21
|
+
contract: string;
|
|
22
|
+
types: {
|
|
23
|
+
[k: string]: {
|
|
24
|
+
size: any;
|
|
25
|
+
capabilities: any;
|
|
26
|
+
renderer: any;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
npcs: {
|
|
31
|
+
schemaVersion: number;
|
|
32
|
+
kind: string;
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
version: string;
|
|
36
|
+
contract: string;
|
|
37
|
+
entries: {
|
|
38
|
+
role: any;
|
|
39
|
+
id: string;
|
|
40
|
+
template?: string;
|
|
41
|
+
profile?: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
gender?: import("./schema.ts").Gender;
|
|
45
|
+
appearance?: import("./schema.ts").Appearance;
|
|
46
|
+
spawn?: string;
|
|
47
|
+
shift?: import("./schema.ts").Shift;
|
|
48
|
+
pose?: import("./schema.ts").NpcPose;
|
|
49
|
+
}[];
|
|
50
|
+
};
|
|
51
|
+
lifeActivities: {
|
|
52
|
+
schemaVersion: number;
|
|
53
|
+
kind: string;
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
version: string;
|
|
57
|
+
contract: string;
|
|
58
|
+
entries: any[];
|
|
59
|
+
};
|
|
60
|
+
atmosphere: any;
|
|
61
|
+
environment: any;
|
|
62
|
+
}>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export declare const OFFICE_SPEC_SCHEMA_VERSION: 1;
|
|
2
|
+
export declare const GENDER_VALUES: readonly ["female", "male", "nonbinary", "unspecified"];
|
|
3
|
+
export declare const POSE_VALUES: readonly ["stand", "sit"];
|
|
4
|
+
export declare const ORIENTATION_VALUES: readonly ["horizontal", "vertical"];
|
|
5
|
+
export declare const WEATHER_VALUES: readonly ["clear", "cloudy", "rain", "snow"];
|
|
6
|
+
export declare const OFFICE_SPEC_DEFAULTS: Readonly<{
|
|
7
|
+
style: "builtin/pixel-classic";
|
|
8
|
+
agentSkin: "builtin/tiny-developers";
|
|
9
|
+
atmosphere: "builtin/default-atmosphere";
|
|
10
|
+
environment: "builtin/local-office-environment";
|
|
11
|
+
agentProfile: Readonly<{
|
|
12
|
+
template: "builtin/host-agent";
|
|
13
|
+
}>;
|
|
14
|
+
placements: readonly never[];
|
|
15
|
+
npcs: readonly never[];
|
|
16
|
+
activities: readonly never[];
|
|
17
|
+
}>;
|
|
18
|
+
export type Gender = (typeof GENDER_VALUES)[number];
|
|
19
|
+
export type NpcPose = (typeof POSE_VALUES)[number];
|
|
20
|
+
export type PropOrientation = (typeof ORIENTATION_VALUES)[number];
|
|
21
|
+
export type Weather = (typeof WEATHER_VALUES)[number];
|
|
22
|
+
export interface Shift {
|
|
23
|
+
start: string;
|
|
24
|
+
end: string;
|
|
25
|
+
/** Optional latest departure; each NPC gets a stable daily time in the range. */
|
|
26
|
+
endLatest?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface Appearance {
|
|
29
|
+
skin?: string;
|
|
30
|
+
hair?: string;
|
|
31
|
+
shirt?: string;
|
|
32
|
+
trim?: string;
|
|
33
|
+
badge?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface OfficePlacement {
|
|
36
|
+
id: string;
|
|
37
|
+
component: string;
|
|
38
|
+
slot: string;
|
|
39
|
+
orientation?: PropOrientation;
|
|
40
|
+
}
|
|
41
|
+
export interface OfficeNpc {
|
|
42
|
+
id: string;
|
|
43
|
+
template?: string;
|
|
44
|
+
profile?: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
title?: string;
|
|
47
|
+
gender?: Gender;
|
|
48
|
+
appearance?: Appearance;
|
|
49
|
+
spawn?: string;
|
|
50
|
+
shift?: Shift;
|
|
51
|
+
pose?: NpcPose;
|
|
52
|
+
}
|
|
53
|
+
export interface AgentProfile {
|
|
54
|
+
template: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
appearance?: Appearance;
|
|
58
|
+
}
|
|
59
|
+
export interface EnvironmentOverrides {
|
|
60
|
+
clock?: {
|
|
61
|
+
mode: "local" | "fixed";
|
|
62
|
+
fixedTime?: string;
|
|
63
|
+
};
|
|
64
|
+
weather?: {
|
|
65
|
+
fallback: Weather;
|
|
66
|
+
};
|
|
67
|
+
lighting?: {
|
|
68
|
+
auto: boolean;
|
|
69
|
+
};
|
|
70
|
+
npcSchedule?: {
|
|
71
|
+
defaultShift?: Shift;
|
|
72
|
+
roleOverrides?: Record<string, Shift>;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface OfficeSpec {
|
|
76
|
+
schemaVersion: typeof OFFICE_SPEC_SCHEMA_VERSION;
|
|
77
|
+
kind: "office-spec";
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
origin: "official" | "custom";
|
|
81
|
+
basePreset?: string;
|
|
82
|
+
layout: string;
|
|
83
|
+
style: string;
|
|
84
|
+
agentSkin: string;
|
|
85
|
+
placements: OfficePlacement[];
|
|
86
|
+
npcs: OfficeNpc[];
|
|
87
|
+
activities: string[];
|
|
88
|
+
atmosphere: string;
|
|
89
|
+
environment: string;
|
|
90
|
+
agentProfile?: AgentProfile;
|
|
91
|
+
environmentOverrides?: EnvironmentOverrides;
|
|
92
|
+
/** Plain text for named, fixed display areas; empty text hides an area. */
|
|
93
|
+
texts?: Record<string, string>;
|
|
94
|
+
}
|
|
95
|
+
export interface OfficePatch {
|
|
96
|
+
schemaVersion: typeof OFFICE_SPEC_SCHEMA_VERSION;
|
|
97
|
+
kind: "office-patch";
|
|
98
|
+
id?: string;
|
|
99
|
+
base: string;
|
|
100
|
+
name?: string;
|
|
101
|
+
components?: {
|
|
102
|
+
style?: string;
|
|
103
|
+
agentSkin?: string;
|
|
104
|
+
atmosphere?: string;
|
|
105
|
+
environment?: string;
|
|
106
|
+
};
|
|
107
|
+
placements?: {
|
|
108
|
+
upsert?: OfficePlacement[];
|
|
109
|
+
remove?: string[];
|
|
110
|
+
};
|
|
111
|
+
npcs?: {
|
|
112
|
+
upsert?: OfficeNpc[];
|
|
113
|
+
remove?: string[];
|
|
114
|
+
};
|
|
115
|
+
activities?: {
|
|
116
|
+
enable?: string[];
|
|
117
|
+
disable?: string[];
|
|
118
|
+
};
|
|
119
|
+
environmentOverrides?: EnvironmentOverrides | null;
|
|
120
|
+
agentProfile?: AgentProfile | null;
|
|
121
|
+
texts?: Record<string, string> | null;
|
|
122
|
+
}
|
|
123
|
+
export interface OfficeSeed {
|
|
124
|
+
schemaVersion: typeof OFFICE_SPEC_SCHEMA_VERSION;
|
|
125
|
+
kind: "office-seed";
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
layout: string;
|
|
129
|
+
style?: string;
|
|
130
|
+
agentSkin?: string;
|
|
131
|
+
atmosphere?: string;
|
|
132
|
+
environment?: string;
|
|
133
|
+
agentProfile?: AgentProfile;
|
|
134
|
+
}
|
|
135
|
+
export interface SchemaIssue {
|
|
136
|
+
path: string;
|
|
137
|
+
message: string;
|
|
138
|
+
}
|
|
139
|
+
export declare function validateOfficeSpecShape(input: unknown): SchemaIssue[];
|
|
140
|
+
export declare function validateOfficePatchShape(input: unknown): SchemaIssue[];
|
|
141
|
+
export declare function validateOfficeSeedShape(input: unknown): SchemaIssue[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type SchemaIssue } from "./schema.ts";
|
|
2
|
+
export interface ComponentLibraryView {
|
|
3
|
+
descriptors: {
|
|
4
|
+
styles: any[];
|
|
5
|
+
layouts: any[];
|
|
6
|
+
agentSkins: any[];
|
|
7
|
+
atmospheres: any[];
|
|
8
|
+
environments: any[];
|
|
9
|
+
};
|
|
10
|
+
styles: Set<string>;
|
|
11
|
+
layouts: Map<string, any>;
|
|
12
|
+
agentSkins: Set<string>;
|
|
13
|
+
props: Map<string, any>;
|
|
14
|
+
npcTemplates: Map<string, any>;
|
|
15
|
+
agentProfileTemplates: Map<string, any>;
|
|
16
|
+
activityRecipes: Map<string, any>;
|
|
17
|
+
activityImplementations: Map<string, any>;
|
|
18
|
+
atmospheres: Set<string>;
|
|
19
|
+
environments: Set<string>;
|
|
20
|
+
defaultNpcTemplate: string;
|
|
21
|
+
npcProfilePolicy: {
|
|
22
|
+
selection: string;
|
|
23
|
+
seedFrom: string;
|
|
24
|
+
persistResolvedProfile: boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface ValidationIssue extends SchemaIssue {
|
|
28
|
+
code: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ValidationResult {
|
|
31
|
+
valid: boolean;
|
|
32
|
+
issues: ValidationIssue[];
|
|
33
|
+
}
|
|
34
|
+
export declare function validateOfficeSpec(spec: unknown, library: ComponentLibraryView): ValidationResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Hard local-renderer limits. Presets may recommend fewer items. */
|
|
2
|
+
export declare const SCENE_LIMITS: Readonly<{
|
|
3
|
+
agents: 16;
|
|
4
|
+
seats: 8;
|
|
5
|
+
npcs: 12;
|
|
6
|
+
props: 80;
|
|
7
|
+
animatedProps: 24;
|
|
8
|
+
activities: 16;
|
|
9
|
+
effects: 40;
|
|
10
|
+
visibleBubbles: 4;
|
|
11
|
+
queuedBubbles: 8;
|
|
12
|
+
}>;
|
|
13
|
+
export type SceneLimitKey = keyof typeof SCENE_LIMITS;
|
|
14
|
+
export declare function withinSceneLimit(kind: SceneLimitKey, count: number): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OfficeAction } from "./protocol.ts";
|
|
2
|
+
export declare function isDelegationTool(toolName: string): boolean;
|
|
3
|
+
export declare function actionForTool(toolName: string): OfficeAction;
|
|
4
|
+
/** Human-readable one-liner shown in the speech bubble and the activity log. */
|
|
5
|
+
export declare function labelForTool(toolName: string, args?: Record<string, any>): string;
|
|
6
|
+
export interface DelegatedTask {
|
|
7
|
+
agent: string;
|
|
8
|
+
task: string;
|
|
9
|
+
/** Index used to build a stable child id for parallel/chained runs. */
|
|
10
|
+
slot: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Normalises the shapes the subagent tool accepts (single / parallel / chain)
|
|
14
|
+
* into a flat list of workers to bring into the office.
|
|
15
|
+
*/
|
|
16
|
+
export declare function describeDelegation(args?: Record<string, any>): DelegatedTask[];
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-neutral wire protocol between coding-agent adapters and Agent Live renderers.
|
|
3
|
+
* Kept dependency-free so both sides can share the vocabulary without a build step.
|
|
4
|
+
*/
|
|
5
|
+
export type AgentState = "idle" | "thinking" | "working" | "waiting" | "talking" | "done" | "error";
|
|
6
|
+
/** Where the character physically goes in the office for a given piece of work. */
|
|
7
|
+
export type OfficeAction = "type" | "archive" | "server" | "whiteboard" | "phone" | "delegate" | "coffee";
|
|
8
|
+
export interface AgentView {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
role: string;
|
|
12
|
+
/** Parent agent id for delegated workers. */
|
|
13
|
+
parent?: string;
|
|
14
|
+
state: AgentState;
|
|
15
|
+
/** Short human label of what it is doing right now. */
|
|
16
|
+
detail?: string;
|
|
17
|
+
action?: OfficeAction;
|
|
18
|
+
task?: string;
|
|
19
|
+
thought?: string;
|
|
20
|
+
model?: string;
|
|
21
|
+
tokens: number;
|
|
22
|
+
cost: number;
|
|
23
|
+
toolCalls: number;
|
|
24
|
+
joinedAt: number;
|
|
25
|
+
seat?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface LogItem {
|
|
28
|
+
at: number;
|
|
29
|
+
agentId: string;
|
|
30
|
+
kind: "thought" | "say" | "tool" | "delegate" | "join" | "leave" | "system";
|
|
31
|
+
text: string;
|
|
32
|
+
}
|
|
33
|
+
export interface SessionInfo {
|
|
34
|
+
cwd: string;
|
|
35
|
+
model?: string;
|
|
36
|
+
thinkingLevel?: string;
|
|
37
|
+
busy: boolean;
|
|
38
|
+
turns: number;
|
|
39
|
+
startedAt: number;
|
|
40
|
+
}
|
|
41
|
+
export type OfficeDelta = {
|
|
42
|
+
type: "session";
|
|
43
|
+
session: SessionInfo;
|
|
44
|
+
} | {
|
|
45
|
+
type: "agent_join";
|
|
46
|
+
agent: AgentView;
|
|
47
|
+
} | {
|
|
48
|
+
type: "agent_leave";
|
|
49
|
+
id: string;
|
|
50
|
+
ok?: boolean;
|
|
51
|
+
} | {
|
|
52
|
+
type: "agent_state";
|
|
53
|
+
id: string;
|
|
54
|
+
state: AgentState;
|
|
55
|
+
detail?: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: "task";
|
|
58
|
+
id: string;
|
|
59
|
+
task: string;
|
|
60
|
+
} | {
|
|
61
|
+
type: "thought";
|
|
62
|
+
id: string;
|
|
63
|
+
text: string;
|
|
64
|
+
} | {
|
|
65
|
+
type: "say";
|
|
66
|
+
id: string;
|
|
67
|
+
text: string;
|
|
68
|
+
} | {
|
|
69
|
+
type: "action";
|
|
70
|
+
id: string;
|
|
71
|
+
action: OfficeAction;
|
|
72
|
+
label: string;
|
|
73
|
+
toolCallId: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: "action_end";
|
|
76
|
+
id: string;
|
|
77
|
+
toolCallId: string;
|
|
78
|
+
ok: boolean;
|
|
79
|
+
} | {
|
|
80
|
+
type: "delegate";
|
|
81
|
+
from: string;
|
|
82
|
+
to: string;
|
|
83
|
+
task: string;
|
|
84
|
+
} | {
|
|
85
|
+
type: "usage";
|
|
86
|
+
id: string;
|
|
87
|
+
tokens: number;
|
|
88
|
+
cost: number;
|
|
89
|
+
} | {
|
|
90
|
+
type: "log";
|
|
91
|
+
item: LogItem;
|
|
92
|
+
};
|
|
93
|
+
/** One replayable engine event with its original wall-clock timestamp. */
|
|
94
|
+
export interface RecordedOfficeEvent {
|
|
95
|
+
at: number;
|
|
96
|
+
event: OfficeDelta;
|
|
97
|
+
}
|
|
98
|
+
export type OfficeEvent = {
|
|
99
|
+
type: "snapshot";
|
|
100
|
+
agents: AgentView[];
|
|
101
|
+
log: LogItem[];
|
|
102
|
+
session: SessionInfo;
|
|
103
|
+
history: RecordedOfficeEvent[];
|
|
104
|
+
} | OfficeDelta;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CreatorService } from "./service.ts";
|
|
2
|
+
type CommandResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
data: unknown;
|
|
5
|
+
adjustments?: unknown[];
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
error: string;
|
|
9
|
+
issues?: unknown[];
|
|
10
|
+
adjustments?: unknown[];
|
|
11
|
+
};
|
|
12
|
+
/** Closed command surface used by every host integration; it never executes arbitrary code or paths. */
|
|
13
|
+
export declare class CreatorCommandRouter {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(creator: CreatorService);
|
|
16
|
+
execute(value: unknown): Promise<CommandResult>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const CREATOR_MODE_CONTEXT = "Agent Live Creator Mode is active for this session.\nTreat office-related natural language as a request to modify the currently selected Custom Office and use the agent_live_creator tool.\nThe currently selected Office is the only edit target. Do not inspect files, search for another copy, deliberate about replacement, invent a new Office id, or pass base/id unless the user explicitly selected another listed Office.\nOn the first edit, call list_components with the default compact summary at most once to obtain the current Agent Profile, text areas, and NPC ids. Then call customize immediately. Do not call list_offices or broader component categories unless the request genuinely needs an unknown choice.\nFor common edits, use these internal Patch shapes: agentProfile { template: \"builtin/host-agent\", name?, title? }; texts { company?, notice?, slogan? }; npcs { upsert: [{ id, template?, name?, title?, gender?, spawn?, pose? }], remove?: [id] }. Rename an existing NPC by its summary id. Add an ordinary colleague with a unique id and template \"builtin/colleague\"; omitted profile and appearance are resolved deterministically.\nDo not expose schemas, patches, or component ids unless explicitly asked for implementation details.\nIf a request is unrelated to the office or ambiguous, do not perform it. Explain that Creator Mode is active and offer exactly these choices: continue editing, /agent-live list presets, /agent-live preset <number or name>, /agent-live custom, or /agent-live exit.\nMap a request like \"make me a police station\" onto the closest complete Preset Office, then change its name, people, identities, furniture, style and activities. If the request needs a brand-new room structure (walls, areas, lanes, seats or work stations), say that it requires adding a new Office Preset and therefore a source change; never offer to swap a room in place.\nAn Office keeps its room. Moving to another room means selecting that Preset Office and editing a copy of it.\nAfter every response, state that Creator Mode remains active and mention /agent-live exit.";
|
|
2
|
+
/** Host-neutral, in-memory Creator state keyed by the host's stable session identity. */
|
|
3
|
+
export declare class CreatorModeRegistry {
|
|
4
|
+
#private;
|
|
5
|
+
enter(sessionId: string): void;
|
|
6
|
+
exit(sessionId: string): boolean;
|
|
7
|
+
isActive(sessionId: string): boolean;
|
|
8
|
+
clear(): void;
|
|
9
|
+
}
|