@agent-os-lab/agent-game-sdk 0.1.13 → 0.1.15
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 +6 -0
- package/USAGE.md +7 -0
- package/package.json +1 -1
- package/src/avatar/three-scene.ts +37 -8
- package/src/avatar/three-thumbnail.ts +17 -2
- package/src/avatar/three-view.ts +6 -2
- package/src/core/agent-game-store.ts +5 -5
- package/src/core/agent-service-event-adapter.ts +2 -2
- package/src/core/assets.ts +2 -2
- package/src/core/event-adapter.ts +2 -2
- package/src/core/index.ts +23 -23
- package/src/core/life-presets.ts +2 -2
- package/src/core/movement.ts +4 -4
- package/src/core/office-building-layout.ts +6 -6
- package/src/core/office-layout.ts +1 -1
- package/src/core/pixel-character-avatar.ts +2 -2
- package/src/core/pixel-character.ts +1 -1
- package/src/core/realtime-events.ts +3 -3
- package/src/core/realtime-transport.ts +1 -1
- package/src/core/reducer.ts +4 -4
- package/src/core/scene.ts +1 -1
- package/src/core/schedule.ts +1 -1
- package/src/core/sequence.ts +1 -1
- package/src/core/state.ts +2 -2
- package/src/core/svg-pixel-avatar.ts +1 -1
- package/src/core/town-office-room-presets.ts +2 -2
- package/src/core/town-office-seat-layout.ts +3 -3
- package/src/graph.ts +1 -1
- package/src/phaser/agent-game-scene.ts +8 -8
- package/src/phaser/anchor-debug.ts +4 -4
- package/src/phaser/avatar-registry.ts +1 -1
- package/src/phaser/camera-controls.ts +1 -1
- package/src/phaser/create-agent-game.ts +8 -8
- package/src/phaser/debug-overlay.ts +3 -3
- package/src/phaser/index.ts +13 -13
- package/src/phaser/office-background.ts +3 -3
- package/src/phaser/office-building-renderer.ts +4 -4
- package/src/phaser/office-layout-renderer.ts +3 -3
- package/src/phaser/scene-reconciler.ts +4 -4
- package/src/phaser/scene-renderer.ts +6 -6
- package/src/phaser/town-office-business-props.ts +1 -1
- package/src/phaser/town-office-environment.ts +3 -3
- package/src/phaser/town-office-furniture.ts +1 -1
- package/src/phaser/town-office-primitives.ts +4 -4
- package/src/phaser/town-office-renderer.ts +9 -9
- package/src/phaser/types.ts +11 -11
package/README.md
CHANGED
|
@@ -94,6 +94,12 @@ const view = mountAgentAvatar3D(container, {
|
|
|
94
94
|
sceneState: "working",
|
|
95
95
|
framing: "upperBody",
|
|
96
96
|
viewAngle: "front",
|
|
97
|
+
camera: {
|
|
98
|
+
fov: 32,
|
|
99
|
+
positionY: 2.1,
|
|
100
|
+
positionZ: 1.35,
|
|
101
|
+
lookAtY: 1.42,
|
|
102
|
+
},
|
|
97
103
|
});
|
|
98
104
|
|
|
99
105
|
view.update({ sceneState: "thinking", framing: "fullBody", viewAngle: "threeQuarter" });
|
package/USAGE.md
CHANGED
|
@@ -191,6 +191,12 @@ const view = mountAgentAvatar3D(container, {
|
|
|
191
191
|
sceneState: "working",
|
|
192
192
|
framing: "upperBody",
|
|
193
193
|
viewAngle: "front",
|
|
194
|
+
camera: {
|
|
195
|
+
fov: 32,
|
|
196
|
+
positionY: 2.1,
|
|
197
|
+
positionZ: 1.35,
|
|
198
|
+
lookAtY: 1.42,
|
|
199
|
+
},
|
|
194
200
|
});
|
|
195
201
|
|
|
196
202
|
view.update({
|
|
@@ -203,6 +209,7 @@ view.destroy();
|
|
|
203
209
|
```
|
|
204
210
|
|
|
205
211
|
`framing` supports `fullBody` and `upperBody`. `viewAngle` supports `front` and `threeQuarter`.
|
|
212
|
+
Use `camera` to fine-tune the portrait crop with `fov`, `positionY`, `positionZ`, and `lookAtY`.
|
|
206
213
|
Passing the same `agentId` used in the office game gives the standalone 3D view the same appearance as the office game scene. Use `renderIndex` only when you need to override that AgentID-derived appearance.
|
|
207
214
|
|
|
208
215
|
### Static 3D Thumbnails
|
package/package.json
CHANGED
|
@@ -17,8 +17,18 @@ import {
|
|
|
17
17
|
import { createAgentMesh, type AgentMeshParts } from "../office/renderers/three/agent-mesh";
|
|
18
18
|
import type { AgentAvatar3DFraming, AgentAvatar3DViewAngle } from "./three-view";
|
|
19
19
|
|
|
20
|
+
export type AgentAvatar3DCameraOptions = {
|
|
21
|
+
fov?: number;
|
|
22
|
+
positionY?: number;
|
|
23
|
+
positionZ?: number;
|
|
24
|
+
lookAtY?: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type ResolvedAgentAvatar3DCameraOptions = Required<AgentAvatar3DCameraOptions>;
|
|
28
|
+
|
|
20
29
|
export type AgentAvatar3DSceneOptions = {
|
|
21
30
|
agent?: Partial<AgentGameOfficeAgent>;
|
|
31
|
+
camera?: AgentAvatar3DCameraOptions;
|
|
22
32
|
agentId?: string;
|
|
23
33
|
framing?: AgentAvatar3DFraming;
|
|
24
34
|
sceneState?: AgentGameOfficeSceneState;
|
|
@@ -29,6 +39,7 @@ export type AgentAvatar3DSceneOptions = {
|
|
|
29
39
|
};
|
|
30
40
|
|
|
31
41
|
export type ResolvedAgentAvatar3DState = AgentGameOfficeAgent & {
|
|
42
|
+
camera: ResolvedAgentAvatar3DCameraOptions;
|
|
32
43
|
framing: AgentAvatar3DFraming;
|
|
33
44
|
renderIndex: number;
|
|
34
45
|
viewAngle: AgentAvatar3DViewAngle;
|
|
@@ -59,7 +70,7 @@ export function createAgentAvatar3DScene(options: AgentAvatar3DSceneOptions): Ag
|
|
|
59
70
|
const mesh = createAgentMesh(state, state.renderIndex);
|
|
60
71
|
mesh.group.position.set(0, 0, 0);
|
|
61
72
|
applyAvatar3DViewAngle(mesh.group, state.viewAngle);
|
|
62
|
-
|
|
73
|
+
applyAvatar3DCamera(camera, state.camera);
|
|
63
74
|
scene.add(mesh.group);
|
|
64
75
|
const bodyLayer = createAgentBodyInstancedLayer(scene);
|
|
65
76
|
const effectLayer = createAgentEffectInstancedLayer(scene);
|
|
@@ -76,7 +87,7 @@ export function createAgentAvatar3DScene(options: AgentAvatar3DSceneOptions): Ag
|
|
|
76
87
|
setState(nextOptions, preservedRenderIndex) {
|
|
77
88
|
state = resolveAgentAvatar3DState(nextOptions, preservedRenderIndex);
|
|
78
89
|
applyAvatar3DViewAngle(mesh.group, state.viewAngle);
|
|
79
|
-
|
|
90
|
+
applyAvatar3DCamera(camera, state.camera);
|
|
80
91
|
return state;
|
|
81
92
|
},
|
|
82
93
|
render(renderer, nowMs) {
|
|
@@ -106,6 +117,7 @@ export function resolveAgentAvatar3DState(
|
|
|
106
117
|
};
|
|
107
118
|
return {
|
|
108
119
|
...agent,
|
|
120
|
+
camera: resolveAgentAvatar3DCamera(options.framing ?? "fullBody", options.camera),
|
|
109
121
|
framing: options.framing ?? "fullBody",
|
|
110
122
|
sceneState: options.sceneState ?? agent.sceneState,
|
|
111
123
|
renderIndex: options.renderIndex ?? preservedRenderIndex ?? resolveAgentAvatarRenderIndex(agent.id),
|
|
@@ -113,15 +125,32 @@ export function resolveAgentAvatar3DState(
|
|
|
113
125
|
};
|
|
114
126
|
}
|
|
115
127
|
|
|
116
|
-
function
|
|
128
|
+
function resolveAgentAvatar3DCamera(
|
|
129
|
+
framing: AgentAvatar3DFraming,
|
|
130
|
+
camera?: AgentAvatar3DCameraOptions,
|
|
131
|
+
): ResolvedAgentAvatar3DCameraOptions {
|
|
117
132
|
if (framing === "upperBody") {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
return {
|
|
134
|
+
fov: camera?.fov ?? 32,
|
|
135
|
+
positionY: camera?.positionY ?? 2.1,
|
|
136
|
+
positionZ: camera?.positionZ ?? 1.35,
|
|
137
|
+
lookAtY: camera?.lookAtY ?? 1.42,
|
|
138
|
+
};
|
|
121
139
|
}
|
|
122
140
|
|
|
123
|
-
|
|
124
|
-
|
|
141
|
+
return {
|
|
142
|
+
fov: camera?.fov ?? 38,
|
|
143
|
+
positionY: camera?.positionY ?? 2.1,
|
|
144
|
+
positionZ: camera?.positionZ ?? 5.2,
|
|
145
|
+
lookAtY: camera?.lookAtY ?? 1.05,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function applyAvatar3DCamera(camera: THREE.PerspectiveCamera, options: ResolvedAgentAvatar3DCameraOptions): void {
|
|
150
|
+
camera.fov = options.fov;
|
|
151
|
+
camera.position.set(0, options.positionY, options.positionZ);
|
|
152
|
+
camera.lookAt(0, options.lookAtY, 0);
|
|
153
|
+
camera.updateProjectionMatrix();
|
|
125
154
|
}
|
|
126
155
|
|
|
127
156
|
function applyAvatar3DViewAngle(group: THREE.Group, viewAngle: AgentAvatar3DViewAngle): void {
|
|
@@ -47,6 +47,7 @@ export type AgentAvatar3DThumbnailMountOptions = AgentAvatar3DThumbnailOptions &
|
|
|
47
47
|
export type AgentAvatar3DThumbnailController = {
|
|
48
48
|
image: HTMLImageElement;
|
|
49
49
|
thumbnail: AgentAvatar3DThumbnail;
|
|
50
|
+
update(options: AgentAvatar3DThumbnailOptions): AgentAvatar3DThumbnail;
|
|
50
51
|
destroy(): void;
|
|
51
52
|
};
|
|
52
53
|
|
|
@@ -100,7 +101,8 @@ export function mountAgentAvatar3DThumbnail(
|
|
|
100
101
|
container: HTMLElement,
|
|
101
102
|
options: AgentAvatar3DThumbnailMountOptions,
|
|
102
103
|
): AgentAvatar3DThumbnailController {
|
|
103
|
-
const
|
|
104
|
+
const renderer = createAgentAvatar3DThumbnailRenderer(options);
|
|
105
|
+
let thumbnail = renderer.render(options);
|
|
104
106
|
const image = options.createImage?.() ?? new Image();
|
|
105
107
|
image.src = thumbnail.dataUrl;
|
|
106
108
|
image.width = thumbnail.width;
|
|
@@ -109,8 +111,21 @@ export function mountAgentAvatar3DThumbnail(
|
|
|
109
111
|
|
|
110
112
|
return {
|
|
111
113
|
image,
|
|
112
|
-
thumbnail
|
|
114
|
+
get thumbnail() {
|
|
115
|
+
return thumbnail;
|
|
116
|
+
},
|
|
117
|
+
update(nextOptions) {
|
|
118
|
+
thumbnail = renderer.render({
|
|
119
|
+
...options,
|
|
120
|
+
...nextOptions,
|
|
121
|
+
});
|
|
122
|
+
image.src = thumbnail.dataUrl;
|
|
123
|
+
image.width = thumbnail.width;
|
|
124
|
+
image.height = thumbnail.height;
|
|
125
|
+
return thumbnail;
|
|
126
|
+
},
|
|
113
127
|
destroy() {
|
|
128
|
+
renderer.destroy();
|
|
114
129
|
image.remove();
|
|
115
130
|
},
|
|
116
131
|
};
|
package/src/avatar/three-view.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { AgentGameOfficeAgent, AgentGameOfficeSceneState } from "../office/
|
|
|
4
4
|
import { AgentGameError } from "../core/errors";
|
|
5
5
|
import {
|
|
6
6
|
createAgentAvatar3DScene,
|
|
7
|
+
type AgentAvatar3DCameraOptions,
|
|
7
8
|
type ResolvedAgentAvatar3DState,
|
|
8
9
|
} from "./three-scene";
|
|
9
10
|
|
|
@@ -20,6 +21,7 @@ export type AgentAvatar3DViewAngle = "front" | "threeQuarter";
|
|
|
20
21
|
|
|
21
22
|
export type AgentAvatar3DOptions = {
|
|
22
23
|
agent?: Partial<AgentGameOfficeAgent>;
|
|
24
|
+
camera?: AgentAvatar3DCameraOptions;
|
|
23
25
|
agentId?: string;
|
|
24
26
|
framing?: AgentAvatar3DFraming;
|
|
25
27
|
sceneState?: AgentGameOfficeSceneState;
|
|
@@ -36,7 +38,7 @@ export type AgentAvatar3DOptions = {
|
|
|
36
38
|
|
|
37
39
|
export type AgentAvatar3DUpdateOptions = Partial<Pick<
|
|
38
40
|
AgentAvatar3DOptions,
|
|
39
|
-
"agent" | "agentId" | "framing" | "sceneState" | "renderIndex" | "viewAngle"
|
|
41
|
+
"agent" | "agentId" | "camera" | "framing" | "sceneState" | "renderIndex" | "viewAngle"
|
|
40
42
|
>>;
|
|
41
43
|
|
|
42
44
|
export type AgentAvatar3DController = {
|
|
@@ -47,7 +49,7 @@ export type AgentAvatar3DController = {
|
|
|
47
49
|
getState(): ResolvedAgentAvatar3DState;
|
|
48
50
|
};
|
|
49
51
|
|
|
50
|
-
export type { ResolvedAgentAvatar3DState } from "./three-scene";
|
|
52
|
+
export type { AgentAvatar3DCameraOptions, ResolvedAgentAvatar3DState } from "./three-scene";
|
|
51
53
|
|
|
52
54
|
export function mountAgentAvatar3D(
|
|
53
55
|
container: HTMLElement,
|
|
@@ -84,10 +86,12 @@ export function mountAgentAvatar3D(
|
|
|
84
86
|
throw new AgentGameError("runtime_destroyed", "Agent avatar 3D view has been destroyed");
|
|
85
87
|
}
|
|
86
88
|
const agentIdChanged = nextOptions.agentId !== undefined || nextOptions.agent?.id !== undefined;
|
|
89
|
+
const framingChanged = nextOptions.framing !== undefined && nextOptions.framing !== avatarScene.state.framing;
|
|
87
90
|
const preserveRenderIndex = hasExplicitRenderIndex && nextOptions.renderIndex === undefined && !agentIdChanged;
|
|
88
91
|
avatarScene.setState({
|
|
89
92
|
agent: { ...avatarScene.state, ...nextOptions.agent },
|
|
90
93
|
agentId: nextOptions.agentId,
|
|
94
|
+
camera: nextOptions.camera ?? (framingChanged ? undefined : avatarScene.state.camera),
|
|
91
95
|
framing: nextOptions.framing ?? avatarScene.state.framing,
|
|
92
96
|
sceneState: nextOptions.sceneState ?? avatarScene.state.sceneState,
|
|
93
97
|
renderIndex: nextOptions.renderIndex,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { applyAgentGameCommand, createAgentGameSnapshot } from "./reducer
|
|
2
|
-
import { validateAgentGameScene, type AgentGameSceneDefinition } from "./scene
|
|
3
|
-
import type { AgentGameCommand } from "./commands
|
|
4
|
-
import type { AgentGameAgent, AgentGameSnapshot } from "./state
|
|
1
|
+
import { applyAgentGameCommand, createAgentGameSnapshot } from "./reducer";
|
|
2
|
+
import { validateAgentGameScene, type AgentGameSceneDefinition } from "./scene";
|
|
3
|
+
import type { AgentGameCommand } from "./commands";
|
|
4
|
+
import type { AgentGameAgent, AgentGameSnapshot } from "./state";
|
|
5
5
|
import type {
|
|
6
6
|
AgentGameConnectionStatus,
|
|
7
7
|
AgentGameRealtimeCursor,
|
|
8
8
|
AgentGameRealtimeEvent,
|
|
9
9
|
AgentGameSnapshotPatch,
|
|
10
|
-
} from "./realtime-events
|
|
10
|
+
} from "./realtime-events";
|
|
11
11
|
|
|
12
12
|
export type AgentGameStoreListener = (snapshot: AgentGameSnapshot) => void;
|
|
13
13
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentGameRealtimeEvent } from "./realtime-events
|
|
2
|
-
import { mapAgentServiceEventToGameCommands, type AgentServiceEventLike } from "./event-adapter
|
|
1
|
+
import type { AgentGameRealtimeEvent } from "./realtime-events";
|
|
2
|
+
import { mapAgentServiceEventToGameCommands, type AgentServiceEventLike } from "./event-adapter";
|
|
3
3
|
|
|
4
4
|
export type MapAgentServiceEventToRealtimeEventsOptions = {
|
|
5
5
|
nextId: () => string;
|
package/src/core/assets.ts
CHANGED
package/src/core/index.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export * from "./assets
|
|
2
|
-
export * from "./agent-game-store
|
|
3
|
-
export * from "./agent-service-event-adapter
|
|
4
|
-
export * from "./commands
|
|
5
|
-
export * from "./event-adapter
|
|
6
|
-
export * from "./errors
|
|
7
|
-
export * from "./life-presets
|
|
8
|
-
export * from "./movement
|
|
9
|
-
export * from "./office-building-layout
|
|
10
|
-
export * from "./office-layout
|
|
11
|
-
export * from "./pixel-character-avatar
|
|
12
|
-
export * from "./pixel-character
|
|
13
|
-
export * from "./reducer
|
|
14
|
-
export * from "./realtime-events
|
|
15
|
-
export * from "./realtime-transport
|
|
16
|
-
export * from "./schedule
|
|
17
|
-
export * from "./scene
|
|
18
|
-
export * from "./sequence
|
|
19
|
-
export * from "./state
|
|
20
|
-
export * from "./svg-pixel-avatar
|
|
21
|
-
export * from "./town-office-assets
|
|
22
|
-
export * from "./town-office-room-presets
|
|
23
|
-
export * from "./town-office-seat-layout
|
|
1
|
+
export * from "./assets";
|
|
2
|
+
export * from "./agent-game-store";
|
|
3
|
+
export * from "./agent-service-event-adapter";
|
|
4
|
+
export * from "./commands";
|
|
5
|
+
export * from "./event-adapter";
|
|
6
|
+
export * from "./errors";
|
|
7
|
+
export * from "./life-presets";
|
|
8
|
+
export * from "./movement";
|
|
9
|
+
export * from "./office-building-layout";
|
|
10
|
+
export * from "./office-layout";
|
|
11
|
+
export * from "./pixel-character-avatar";
|
|
12
|
+
export * from "./pixel-character";
|
|
13
|
+
export * from "./reducer";
|
|
14
|
+
export * from "./realtime-events";
|
|
15
|
+
export * from "./realtime-transport";
|
|
16
|
+
export * from "./schedule";
|
|
17
|
+
export * from "./scene";
|
|
18
|
+
export * from "./sequence";
|
|
19
|
+
export * from "./state";
|
|
20
|
+
export * from "./svg-pixel-avatar";
|
|
21
|
+
export * from "./town-office-assets";
|
|
22
|
+
export * from "./town-office-room-presets";
|
|
23
|
+
export * from "./town-office-seat-layout";
|
package/src/core/life-presets.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentGameAnchor, AgentGameSceneDefinition } from "./scene
|
|
2
|
-
import { validateAgentGameScene } from "./scene
|
|
1
|
+
import type { AgentGameAnchor, AgentGameSceneDefinition } from "./scene";
|
|
2
|
+
import { validateAgentGameScene } from "./scene";
|
|
3
3
|
|
|
4
4
|
export type AgentGameLifeSceneKind = "home" | "cafe" | "commute" | "sleep";
|
|
5
5
|
|
package/src/core/movement.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AgentGameError } from "./errors
|
|
2
|
-
import { findAgentGameAnchor } from "./scene
|
|
3
|
-
import type { AgentGameCommand } from "./commands
|
|
4
|
-
import type { AgentGameSnapshot } from "./state
|
|
1
|
+
import { AgentGameError } from "./errors";
|
|
2
|
+
import { findAgentGameAnchor } from "./scene";
|
|
3
|
+
import type { AgentGameCommand } from "./commands";
|
|
4
|
+
import type { AgentGameSnapshot } from "./state";
|
|
5
5
|
|
|
6
6
|
export type CreateAgentGameMovePathCommandsOptions = {
|
|
7
7
|
agentId: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AgentGameError } from "./errors
|
|
2
|
-
import type { OfficeObjectAtlasDefinition } from "./office-layout
|
|
1
|
+
import { AgentGameError } from "./errors";
|
|
2
|
+
import type { OfficeObjectAtlasDefinition } from "./office-layout";
|
|
3
3
|
import type {
|
|
4
4
|
AgentGameAnchor,
|
|
5
5
|
AgentGameAnchorKind,
|
|
6
6
|
AgentGameDirection,
|
|
7
7
|
AgentGameSceneDefinition,
|
|
8
|
-
} from "./scene
|
|
9
|
-
import { validateAgentGameScene } from "./scene
|
|
10
|
-
import { createTownOfficeRoomAnchors } from "./town-office-seat-layout
|
|
11
|
-
import { isTownOfficeRoomType, type TownOfficeRoomType } from "./town-office-assets
|
|
8
|
+
} from "./scene";
|
|
9
|
+
import { validateAgentGameScene } from "./scene";
|
|
10
|
+
import { createTownOfficeRoomAnchors } from "./town-office-seat-layout";
|
|
11
|
+
import { isTownOfficeRoomType, type TownOfficeRoomType } from "./town-office-assets";
|
|
12
12
|
|
|
13
13
|
export type OfficeBuildingGridRect = {
|
|
14
14
|
x: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentAvatarDefinition } from "./assets
|
|
2
|
-
import type { PixelCharacterSprite } from "./pixel-character
|
|
1
|
+
import type { AgentAvatarDefinition } from "./assets";
|
|
2
|
+
import type { PixelCharacterSprite } from "./pixel-character";
|
|
3
3
|
|
|
4
4
|
export type PixelCharacterAvatarAtlas = {
|
|
5
5
|
frames: Record<string, { frame: { x: number; y: number; w: number; h: number } }>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REQUIRED_AGENT_AVATAR_ANIMATIONS,
|
|
3
3
|
type AgentAvatarAnimationName,
|
|
4
|
-
} from "./assets
|
|
4
|
+
} from "./assets";
|
|
5
5
|
|
|
6
6
|
export type PixelCharacterRole = "engineer" | "manager" | "support" | string;
|
|
7
7
|
export type PixelCharacterStyle = "office" | "simple-chibi";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentGameCommand } from "./commands
|
|
2
|
-
import type { AgentGameSceneDefinition } from "./scene
|
|
3
|
-
import type { AgentGameAgent, AgentGameSnapshot } from "./state
|
|
1
|
+
import type { AgentGameCommand } from "./commands";
|
|
2
|
+
import type { AgentGameSceneDefinition } from "./scene";
|
|
3
|
+
import type { AgentGameAgent, AgentGameSnapshot } from "./state";
|
|
4
4
|
|
|
5
5
|
export type AgentGameRealtimeCursor = string;
|
|
6
6
|
|
package/src/core/reducer.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AgentGameCommand } from "./commands
|
|
2
|
-
import { AgentGameError } from "./errors
|
|
3
|
-
import { findAgentGameAnchor, validateAgentGameScene, type AgentGameSceneDefinition } from "./scene
|
|
4
|
-
import type { AgentGameAgent, AgentGameSnapshot } from "./state
|
|
1
|
+
import type { AgentGameCommand } from "./commands";
|
|
2
|
+
import { AgentGameError } from "./errors";
|
|
3
|
+
import { findAgentGameAnchor, validateAgentGameScene, type AgentGameSceneDefinition } from "./scene";
|
|
4
|
+
import type { AgentGameAgent, AgentGameSnapshot } from "./state";
|
|
5
5
|
|
|
6
6
|
export function createAgentGameSnapshot(scene: AgentGameSceneDefinition): AgentGameSnapshot {
|
|
7
7
|
return {
|
package/src/core/scene.ts
CHANGED
package/src/core/schedule.ts
CHANGED
package/src/core/sequence.ts
CHANGED
package/src/core/state.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentGameEmotion, AgentToolCallStatus } from "./commands
|
|
2
|
-
import type { AgentGameDirection, AgentGameSceneDefinition } from "./scene
|
|
1
|
+
import type { AgentGameEmotion, AgentToolCallStatus } from "./commands";
|
|
2
|
+
import type { AgentGameDirection, AgentGameSceneDefinition } from "./scene";
|
|
3
3
|
|
|
4
4
|
export type AgentGameActivity =
|
|
5
5
|
| { kind: "idle" }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OfficeBuildingObjectDefinition } from "./office-building-layout
|
|
2
|
-
import type { TownOfficeObjectFrame, TownOfficeRoomType } from "./town-office-assets
|
|
1
|
+
import type { OfficeBuildingObjectDefinition } from "./office-building-layout";
|
|
2
|
+
import type { TownOfficeObjectFrame, TownOfficeRoomType } from "./town-office-assets";
|
|
3
3
|
|
|
4
4
|
export type TownOfficeRoomObjectsOptions = {
|
|
5
5
|
roomId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OfficeBuildingAnchorDefinition } from "./office-building-layout
|
|
2
|
-
import type { AgentGameAnchorKind } from "./scene
|
|
3
|
-
import type { TownOfficeRoomType } from "./town-office-assets
|
|
1
|
+
import type { OfficeBuildingAnchorDefinition } from "./office-building-layout";
|
|
2
|
+
import type { AgentGameAnchorKind } from "./scene";
|
|
3
|
+
import type { TownOfficeRoomType } from "./town-office-assets";
|
|
4
4
|
|
|
5
5
|
export type TownOfficeRoomAnchorsOptions = {
|
|
6
6
|
roomId: string;
|
package/src/graph.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { AgentAvatarDefinition, AgentGameSceneDefinition, OfficeBuildingLayout, OfficeLayoutDefinition } from "../core/index
|
|
2
|
-
import { drawAnchorDebug } from "./anchor-debug
|
|
3
|
-
import { registerAgentAvatarAnimations } from "./avatar-registry
|
|
1
|
+
import type { AgentAvatarDefinition, AgentGameSceneDefinition, OfficeBuildingLayout, OfficeLayoutDefinition } from "../core/index";
|
|
2
|
+
import { drawAnchorDebug } from "./anchor-debug";
|
|
3
|
+
import { registerAgentAvatarAnimations } from "./avatar-registry";
|
|
4
4
|
import {
|
|
5
5
|
installCameraControls,
|
|
6
6
|
type AgentGameCameraControlsController,
|
|
7
7
|
type AgentGameCameraControlsOptions,
|
|
8
|
-
} from "./camera-controls
|
|
9
|
-
import type { AgentGameDebugOverlays } from "./debug-overlay
|
|
8
|
+
} from "./camera-controls";
|
|
9
|
+
import type { AgentGameDebugOverlays } from "./debug-overlay";
|
|
10
10
|
import {
|
|
11
11
|
createDefaultAgentGameSceneRendererRegistry,
|
|
12
12
|
type AgentGameRendererConfig,
|
|
13
13
|
type AgentGameSceneRendererRegistry,
|
|
14
|
-
} from "./scene-renderer
|
|
15
|
-
import type { AgentGameSceneReconciler, PhaserReconcilerSceneLike } from "./scene-reconciler
|
|
16
|
-
import type { TownOfficeDomOverlayRoot } from "./town-office-renderer
|
|
14
|
+
} from "./scene-renderer";
|
|
15
|
+
import type { AgentGameSceneReconciler, PhaserReconcilerSceneLike } from "./scene-reconciler";
|
|
16
|
+
import type { TownOfficeDomOverlayRoot } from "./town-office-renderer";
|
|
17
17
|
|
|
18
18
|
export const AGENT_GAME_PHASER_SCENE_KEY = "agent-game-scene";
|
|
19
19
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AgentGameSceneDefinition } from "../core/index
|
|
2
|
-
import { debugDepth } from "./render-layers
|
|
3
|
-
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler
|
|
4
|
-
import { crispTextStyle } from "./text-style
|
|
1
|
+
import type { AgentGameSceneDefinition } from "../core/index";
|
|
2
|
+
import { debugDepth } from "./render-layers";
|
|
3
|
+
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler";
|
|
4
|
+
import { crispTextStyle } from "./text-style";
|
|
5
5
|
|
|
6
6
|
export type AnchorDebugSceneLike = {
|
|
7
7
|
add: {
|
|
@@ -5,18 +5,18 @@ import {
|
|
|
5
5
|
validateAgentGameScene,
|
|
6
6
|
validateOfficeBuildingLayout,
|
|
7
7
|
validateOfficeLayoutDefinition,
|
|
8
|
-
} from "../core/index
|
|
9
|
-
import { createAgentGamePhaserSceneConfig } from "./agent-game-scene
|
|
8
|
+
} from "../core/index";
|
|
9
|
+
import { createAgentGamePhaserSceneConfig } from "./agent-game-scene";
|
|
10
10
|
import {
|
|
11
11
|
createSceneReconciler,
|
|
12
12
|
type AgentDomOverlayRoot,
|
|
13
13
|
type AgentGameSceneReconciler,
|
|
14
|
-
} from "./scene-reconciler
|
|
15
|
-
import type { AgentGameCameraControlsController } from "./camera-controls
|
|
16
|
-
import type { AgentGameRendererConfig } from "./scene-renderer
|
|
17
|
-
import type { TownOfficeDomOverlayRoot } from "./town-office-renderer
|
|
18
|
-
import type { AgentGameController, AgentGamePhaserOptions, PhaserGameLike } from "./types
|
|
19
|
-
import { resolveAgentGameViewportSize } from "./viewport
|
|
14
|
+
} from "./scene-reconciler";
|
|
15
|
+
import type { AgentGameCameraControlsController } from "./camera-controls";
|
|
16
|
+
import type { AgentGameRendererConfig } from "./scene-renderer";
|
|
17
|
+
import type { TownOfficeDomOverlayRoot } from "./town-office-renderer";
|
|
18
|
+
import type { AgentGameController, AgentGamePhaserOptions, PhaserGameLike } from "./types";
|
|
19
|
+
import { resolveAgentGameViewportSize } from "./viewport";
|
|
20
20
|
|
|
21
21
|
type RuntimeDomOverlayRoot = HTMLElement & AgentDomOverlayRoot & TownOfficeDomOverlayRoot;
|
|
22
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { parseHexColor } from "../core/index
|
|
2
|
-
import type { TownOfficeSceneLike } from "./town-office-primitives
|
|
3
|
-
import { debugDepth } from "./render-layers
|
|
1
|
+
import { parseHexColor } from "../core/index";
|
|
2
|
+
import type { TownOfficeSceneLike } from "./town-office-primitives";
|
|
3
|
+
import { debugDepth } from "./render-layers";
|
|
4
4
|
|
|
5
5
|
export type AgentGameDebugOverlays = {
|
|
6
6
|
worldBounds?: boolean;
|
package/src/phaser/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export * from "./agent-game-scene
|
|
2
|
-
export * from "./avatar-registry
|
|
3
|
-
export * from "./camera-model
|
|
4
|
-
export * from "./camera-controls
|
|
5
|
-
export * from "./create-agent-game
|
|
6
|
-
export * from "./debug-overlay
|
|
7
|
-
export * from "./office-building-renderer
|
|
8
|
-
export * from "./office-layout-renderer
|
|
9
|
-
export * from "./scene-renderer
|
|
10
|
-
export * from "./scene-reconciler
|
|
11
|
-
export * from "./town-office-renderer
|
|
12
|
-
export * from "./types
|
|
13
|
-
export * from "./viewport
|
|
1
|
+
export * from "./agent-game-scene";
|
|
2
|
+
export * from "./avatar-registry";
|
|
3
|
+
export * from "./camera-model";
|
|
4
|
+
export * from "./camera-controls";
|
|
5
|
+
export * from "./create-agent-game";
|
|
6
|
+
export * from "./debug-overlay";
|
|
7
|
+
export * from "./office-building-renderer";
|
|
8
|
+
export * from "./office-layout-renderer";
|
|
9
|
+
export * from "./scene-renderer";
|
|
10
|
+
export * from "./scene-reconciler";
|
|
11
|
+
export * from "./town-office-renderer";
|
|
12
|
+
export * from "./types";
|
|
13
|
+
export * from "./viewport";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentGameSceneDefinition } from "../core/index
|
|
2
|
-
import { officeDepth } from "./render-layers
|
|
3
|
-
import type { PhaserDisplayObjectLike } from "./scene-reconciler
|
|
1
|
+
import type { AgentGameSceneDefinition } from "../core/index";
|
|
2
|
+
import { officeDepth } from "./render-layers";
|
|
3
|
+
import type { PhaserDisplayObjectLike } from "./scene-reconciler";
|
|
4
4
|
|
|
5
5
|
export type OfficeBackgroundSceneLike = {
|
|
6
6
|
add: {
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
getOfficeRoomBounds,
|
|
3
3
|
parseHexColor,
|
|
4
4
|
type OfficeBuildingLayout,
|
|
5
|
-
} from "../core/index
|
|
6
|
-
import { officeDepth } from "./render-layers
|
|
7
|
-
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler
|
|
8
|
-
import { crispTextStyle } from "./text-style
|
|
5
|
+
} from "../core/index";
|
|
6
|
+
import { officeDepth } from "./render-layers";
|
|
7
|
+
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler";
|
|
8
|
+
import { crispTextStyle } from "./text-style";
|
|
9
9
|
|
|
10
10
|
export type OfficeBuildingSceneLike = {
|
|
11
11
|
add: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OfficeLayoutDefinition } from "../core/index
|
|
2
|
-
import { officeDepth } from "./render-layers
|
|
3
|
-
import type { PhaserDisplayObjectLike } from "./scene-reconciler
|
|
1
|
+
import type { OfficeLayoutDefinition } from "../core/index";
|
|
2
|
+
import { officeDepth } from "./render-layers";
|
|
3
|
+
import type { PhaserDisplayObjectLike } from "./scene-reconciler";
|
|
4
4
|
|
|
5
5
|
export type OfficeLayoutSceneLike = {
|
|
6
6
|
add: {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
type AgentGameAgent,
|
|
7
7
|
type AgentGameDirection,
|
|
8
8
|
type AgentGameSnapshot,
|
|
9
|
-
} from "../core/index
|
|
10
|
-
import { createMovementTweenConfig, type MovementTimingOptions } from "./movement-tween
|
|
11
|
-
import { agentDepth, agentUiDepth } from "./render-layers
|
|
12
|
-
import { crispTextStyle } from "./text-style
|
|
9
|
+
} from "../core/index";
|
|
10
|
+
import { createMovementTweenConfig, type MovementTimingOptions } from "./movement-tween";
|
|
11
|
+
import { agentDepth, agentUiDepth } from "./render-layers";
|
|
12
|
+
import { crispTextStyle } from "./text-style";
|
|
13
13
|
|
|
14
14
|
const SPRITE_AGENT_SCALE = 1;
|
|
15
15
|
const SPRITE_AGENT_FOOT_ORIGIN_Y = 1;
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
type AgentGameSceneDefinition,
|
|
4
4
|
type OfficeBuildingLayout,
|
|
5
5
|
type OfficeLayoutDefinition,
|
|
6
|
-
} from "../core/index
|
|
7
|
-
import { drawOfficeBackground } from "./office-background
|
|
8
|
-
import { drawOfficeBuildingLayout } from "./office-building-renderer
|
|
9
|
-
import { drawOfficeLayout } from "./office-layout-renderer
|
|
10
|
-
import type { PhaserReconcilerSceneLike } from "./scene-reconciler
|
|
11
|
-
import { drawTownOfficeBuildingLayout, type TownOfficeBuildingRenderOptions } from "./town-office-renderer
|
|
6
|
+
} from "../core/index";
|
|
7
|
+
import { drawOfficeBackground } from "./office-background";
|
|
8
|
+
import { drawOfficeBuildingLayout } from "./office-building-renderer";
|
|
9
|
+
import { drawOfficeLayout } from "./office-layout-renderer";
|
|
10
|
+
import type { PhaserReconcilerSceneLike } from "./scene-reconciler";
|
|
11
|
+
import { drawTownOfficeBuildingLayout, type TownOfficeBuildingRenderOptions } from "./town-office-renderer";
|
|
12
12
|
|
|
13
13
|
export type AgentGameSceneRenderer = {
|
|
14
14
|
preload?: (scene: PhaserReconcilerSceneLike) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rect, text, type TownOfficeSceneLike } from "./town-office-primitives
|
|
1
|
+
import { rect, text, type TownOfficeSceneLike } from "./town-office-primitives";
|
|
2
2
|
|
|
3
3
|
export function drawServerRack(scene: TownOfficeSceneLike, x: number, y: number, scale: number): void {
|
|
4
4
|
const s = scale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OfficeRoomBounds } from "../core/index
|
|
2
|
-
import { drawBookshelf, drawWhiteboard } from "./town-office-furniture
|
|
3
|
-
import { rect, type TownOfficeSceneLike } from "./town-office-primitives
|
|
1
|
+
import type { OfficeRoomBounds } from "../core/index";
|
|
2
|
+
import { drawBookshelf, drawWhiteboard } from "./town-office-furniture";
|
|
3
|
+
import { rect, type TownOfficeSceneLike } from "./town-office-primitives";
|
|
4
4
|
|
|
5
5
|
export type TownOfficeRoomStyle = {
|
|
6
6
|
floor: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rect, type TownOfficeSceneLike } from "./town-office-primitives
|
|
1
|
+
import { rect, type TownOfficeSceneLike } from "./town-office-primitives";
|
|
2
2
|
|
|
3
3
|
export function drawDesk(scene: TownOfficeSceneLike, x: number, y: number, scale: number, hasMonitor: boolean): void {
|
|
4
4
|
const s = 1.5 * scale;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { parseHexColor } from "../core/index
|
|
2
|
-
import { officeDepth } from "./render-layers
|
|
3
|
-
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler
|
|
4
|
-
import { crispTextStyle } from "./text-style
|
|
1
|
+
import { parseHexColor } from "../core/index";
|
|
2
|
+
import { officeDepth } from "./render-layers";
|
|
3
|
+
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler";
|
|
4
|
+
import { crispTextStyle } from "./text-style";
|
|
5
5
|
|
|
6
6
|
export type TownOfficeSceneLike = {
|
|
7
7
|
add: {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type OfficeBuildingLayout,
|
|
7
7
|
type OfficeBuildingObjectDefinition,
|
|
8
8
|
type OfficeRoomBounds,
|
|
9
|
-
} from "../core/index
|
|
9
|
+
} from "../core/index";
|
|
10
10
|
import {
|
|
11
11
|
drawBattery,
|
|
12
12
|
drawBeaker,
|
|
@@ -33,8 +33,8 @@ import {
|
|
|
33
33
|
drawTree,
|
|
34
34
|
drawTV,
|
|
35
35
|
drawWindTurbine,
|
|
36
|
-
} from "./town-office-business-props
|
|
37
|
-
import { drawWorldBoundsDebugOverlay, type AgentGameDebugOverlays } from "./debug-overlay
|
|
36
|
+
} from "./town-office-business-props";
|
|
37
|
+
import { drawWorldBoundsDebugOverlay, type AgentGameDebugOverlays } from "./debug-overlay";
|
|
38
38
|
import {
|
|
39
39
|
drawAirConditioner,
|
|
40
40
|
drawDoor,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
drawSocket,
|
|
47
47
|
drawWindow,
|
|
48
48
|
type TownOfficeRoomStyle,
|
|
49
|
-
} from "./town-office-environment
|
|
49
|
+
} from "./town-office-environment";
|
|
50
50
|
import {
|
|
51
51
|
drawBench,
|
|
52
52
|
drawBookshelf,
|
|
@@ -70,12 +70,12 @@ import {
|
|
|
70
70
|
drawTrashCan,
|
|
71
71
|
drawVendingMachine,
|
|
72
72
|
drawWhiteboard,
|
|
73
|
-
} from "./town-office-furniture
|
|
74
|
-
import { rect, type TownOfficeSceneLike } from "./town-office-primitives
|
|
75
|
-
import { crispTextStyle } from "./text-style
|
|
76
|
-
import { officeDepth } from "./render-layers
|
|
73
|
+
} from "./town-office-furniture";
|
|
74
|
+
import { rect, type TownOfficeSceneLike } from "./town-office-primitives";
|
|
75
|
+
import { crispTextStyle } from "./text-style";
|
|
76
|
+
import { officeDepth } from "./render-layers";
|
|
77
77
|
|
|
78
|
-
export type { TownOfficeSceneLike } from "./town-office-primitives
|
|
78
|
+
export type { TownOfficeSceneLike } from "./town-office-primitives";
|
|
79
79
|
|
|
80
80
|
const HEADER_HEIGHT = 34;
|
|
81
81
|
const HEADER_TITLE_PADDING_X = 12;
|
package/src/phaser/types.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { AgentGameAssetManifest } from "../core/assets
|
|
2
|
-
import type { AgentGameCommand } from "../core/commands
|
|
3
|
-
import type { OfficeBuildingLayout } from "../core/office-building-layout
|
|
4
|
-
import type { OfficeLayoutDefinition, OfficeObjectAtlasDefinition } from "../core/office-layout
|
|
5
|
-
import type { AgentGameSceneDefinition } from "../core/scene
|
|
6
|
-
import type { AgentGameSnapshot } from "../core/state
|
|
7
|
-
import type { AgentGameStore } from "../core/agent-game-store
|
|
8
|
-
import type { AgentGameCameraControlsController, AgentGameCameraControlsOptions } from "./camera-controls
|
|
9
|
-
import type { AgentGameDebugOverlays } from "./debug-overlay
|
|
10
|
-
import type { AgentGameRendererConfig, AgentGameSceneRendererRegistry } from "./scene-renderer
|
|
11
|
-
import type { AgentGameViewportOptions } from "./viewport
|
|
1
|
+
import type { AgentGameAssetManifest } from "../core/assets";
|
|
2
|
+
import type { AgentGameCommand } from "../core/commands";
|
|
3
|
+
import type { OfficeBuildingLayout } from "../core/office-building-layout";
|
|
4
|
+
import type { OfficeLayoutDefinition, OfficeObjectAtlasDefinition } from "../core/office-layout";
|
|
5
|
+
import type { AgentGameSceneDefinition } from "../core/scene";
|
|
6
|
+
import type { AgentGameSnapshot } from "../core/state";
|
|
7
|
+
import type { AgentGameStore } from "../core/agent-game-store";
|
|
8
|
+
import type { AgentGameCameraControlsController, AgentGameCameraControlsOptions } from "./camera-controls";
|
|
9
|
+
import type { AgentGameDebugOverlays } from "./debug-overlay";
|
|
10
|
+
import type { AgentGameRendererConfig, AgentGameSceneRendererRegistry } from "./scene-renderer";
|
|
11
|
+
import type { AgentGameViewportOptions } from "./viewport";
|
|
12
12
|
|
|
13
13
|
export type PhaserGameLike = {
|
|
14
14
|
destroy(removeCanvas?: boolean): void;
|