@agent-os-lab/agent-game-sdk 0.1.1
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 +99 -0
- package/package.json +38 -0
- package/src/core/agent-game-store.ts +110 -0
- package/src/core/agent-service-event-adapter.ts +20 -0
- package/src/core/assets.ts +119 -0
- package/src/core/commands.ts +42 -0
- package/src/core/errors.ts +19 -0
- package/src/core/event-adapter.ts +40 -0
- package/src/core/index.ts +23 -0
- package/src/core/life-presets.ts +54 -0
- package/src/core/movement.ts +50 -0
- package/src/core/office-building-layout.ts +376 -0
- package/src/core/office-layout.ts +152 -0
- package/src/core/pixel-character-avatar.ts +87 -0
- package/src/core/pixel-character.ts +684 -0
- package/src/core/realtime-events.ts +44 -0
- package/src/core/realtime-transport.ts +39 -0
- package/src/core/reducer.ts +105 -0
- package/src/core/scene.ts +144 -0
- package/src/core/schedule.ts +20 -0
- package/src/core/sequence.ts +48 -0
- package/src/core/state.ts +26 -0
- package/src/core/svg-pixel-avatar.ts +372 -0
- package/src/core/town-office-assets.ts +109 -0
- package/src/core/town-office-room-presets.ts +455 -0
- package/src/core/town-office-seat-layout.ts +238 -0
- package/src/graph.ts +112 -0
- package/src/index.ts +2 -0
- package/src/office/core/projection.ts +89 -0
- package/src/office/core/source.ts +46 -0
- package/src/office/core/types.ts +110 -0
- package/src/office/index.ts +4 -0
- package/src/office/mount.ts +104 -0
- package/src/office/react/AgentGameOfficeView.ts +58 -0
- package/src/office/react/index.ts +1 -0
- package/src/office/renderers/three/agent-activity-effects.ts +161 -0
- package/src/office/renderers/three/agent-animation.ts +205 -0
- package/src/office/renderers/three/agent-body-instancing.ts +119 -0
- package/src/office/renderers/three/agent-label.ts +82 -0
- package/src/office/renderers/three/agent-layout.ts +72 -0
- package/src/office/renderers/three/agent-mesh.ts +145 -0
- package/src/office/renderers/three/mount.ts +253 -0
- package/src/office/renderers/three/scene.ts +790 -0
- package/src/phaser/agent-game-scene.ts +87 -0
- package/src/phaser/anchor-debug.ts +22 -0
- package/src/phaser/avatar-registry.ts +46 -0
- package/src/phaser/camera-controls.ts +419 -0
- package/src/phaser/camera-model.ts +81 -0
- package/src/phaser/create-agent-game.ts +242 -0
- package/src/phaser/debug-overlay.ts +21 -0
- package/src/phaser/index.ts +13 -0
- package/src/phaser/movement-tween.ts +59 -0
- package/src/phaser/office-background.ts +48 -0
- package/src/phaser/office-building-renderer.ts +87 -0
- package/src/phaser/office-layout-renderer.ts +58 -0
- package/src/phaser/render-layers.ts +30 -0
- package/src/phaser/scene-reconciler.ts +614 -0
- package/src/phaser/scene-renderer.ts +138 -0
- package/src/phaser/text-style.ts +8 -0
- package/src/phaser/town-office-business-props.ts +256 -0
- package/src/phaser/town-office-environment.ts +89 -0
- package/src/phaser/town-office-furniture.ts +182 -0
- package/src/phaser/town-office-primitives.ts +53 -0
- package/src/phaser/town-office-renderer.ts +429 -0
- package/src/phaser/types.ts +67 -0
- package/src/phaser/viewport.ts +88 -0
- package/src/runtime-client.ts +435 -0
- package/src/types.ts +80 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AgentGameCommand } from "./commands.js";
|
|
2
|
+
import type { AgentGameSceneDefinition } from "./scene.js";
|
|
3
|
+
import type { AgentGameAgent, AgentGameSnapshot } from "./state.js";
|
|
4
|
+
|
|
5
|
+
export type AgentGameRealtimeCursor = string;
|
|
6
|
+
|
|
7
|
+
export type AgentGameConnectionStatus =
|
|
8
|
+
| { kind: "connecting" }
|
|
9
|
+
| { kind: "open" }
|
|
10
|
+
| { kind: "closed"; reason?: string }
|
|
11
|
+
| { kind: "error"; message: string };
|
|
12
|
+
|
|
13
|
+
export type AgentGameAgentPatch = Partial<AgentGameAgent> | null;
|
|
14
|
+
|
|
15
|
+
export type AgentGameSnapshotPatch = {
|
|
16
|
+
scene?: AgentGameSceneDefinition;
|
|
17
|
+
agents?: Record<string, AgentGameAgentPatch>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type AgentGameRealtimeEvent =
|
|
21
|
+
| {
|
|
22
|
+
id: string;
|
|
23
|
+
cursor: AgentGameRealtimeCursor;
|
|
24
|
+
type: "snapshot";
|
|
25
|
+
snapshot: AgentGameSnapshot;
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
id: string;
|
|
29
|
+
cursor: AgentGameRealtimeCursor;
|
|
30
|
+
type: "command";
|
|
31
|
+
command: AgentGameCommand;
|
|
32
|
+
}
|
|
33
|
+
| {
|
|
34
|
+
id: string;
|
|
35
|
+
cursor: AgentGameRealtimeCursor;
|
|
36
|
+
type: "patch";
|
|
37
|
+
patch: AgentGameSnapshotPatch;
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
id: string;
|
|
41
|
+
cursor: AgentGameRealtimeCursor;
|
|
42
|
+
type: "connection";
|
|
43
|
+
status: AgentGameConnectionStatus;
|
|
44
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AgentGameRealtimeEvent } from "./realtime-events.js";
|
|
2
|
+
|
|
3
|
+
export type AgentGameTransportMessage = AgentGameRealtimeEvent | AgentGameRealtimeEvent[];
|
|
4
|
+
|
|
5
|
+
export type AgentGameTransport = {
|
|
6
|
+
start(): void | Promise<void>;
|
|
7
|
+
stop(): void | Promise<void>;
|
|
8
|
+
subscribe(listener: (event: AgentGameRealtimeEvent) => void): () => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type LocalAgentGameTransport = AgentGameTransport & {
|
|
12
|
+
publish(message: AgentGameTransportMessage): void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function createLocalAgentGameTransport(): LocalAgentGameTransport {
|
|
16
|
+
const listeners = new Set<(event: AgentGameRealtimeEvent) => void>();
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
start() {},
|
|
20
|
+
stop() {},
|
|
21
|
+
subscribe(listener) {
|
|
22
|
+
listeners.add(listener);
|
|
23
|
+
return () => {
|
|
24
|
+
listeners.delete(listener);
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
publish(message) {
|
|
28
|
+
for (const event of normalizeAgentGameTransportMessage(message)) {
|
|
29
|
+
for (const listener of listeners) {
|
|
30
|
+
listener(event);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function normalizeAgentGameTransportMessage(message: AgentGameTransportMessage): AgentGameRealtimeEvent[] {
|
|
38
|
+
return Array.isArray(message) ? message : [message];
|
|
39
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { AgentGameCommand } from "./commands.js";
|
|
2
|
+
import { AgentGameError } from "./errors.js";
|
|
3
|
+
import { findAgentGameAnchor, validateAgentGameScene, type AgentGameSceneDefinition } from "./scene.js";
|
|
4
|
+
import type { AgentGameAgent, AgentGameSnapshot } from "./state.js";
|
|
5
|
+
|
|
6
|
+
export function createAgentGameSnapshot(scene: AgentGameSceneDefinition): AgentGameSnapshot {
|
|
7
|
+
return {
|
|
8
|
+
scene: validateAgentGameScene(scene),
|
|
9
|
+
agents: {},
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function applyAgentGameCommand(snapshot: AgentGameSnapshot, command: AgentGameCommand): AgentGameSnapshot {
|
|
14
|
+
const next: AgentGameSnapshot = {
|
|
15
|
+
scene: snapshot.scene,
|
|
16
|
+
agents: { ...snapshot.agents },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if (command.type === "agent.spawn") {
|
|
20
|
+
const anchor = requireAnchor(next.scene, command.locationId);
|
|
21
|
+
next.agents[command.agentId] = {
|
|
22
|
+
agentId: command.agentId,
|
|
23
|
+
name: command.name,
|
|
24
|
+
avatarId: command.avatarId,
|
|
25
|
+
locationId: command.locationId,
|
|
26
|
+
direction: anchor.direction ?? "down",
|
|
27
|
+
activity: { kind: "idle" },
|
|
28
|
+
};
|
|
29
|
+
return next;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const agent = requireAgent(next, command.agentId);
|
|
33
|
+
|
|
34
|
+
switch (command.type) {
|
|
35
|
+
case "agent.move": {
|
|
36
|
+
const anchor = requireAnchor(next.scene, command.locationId);
|
|
37
|
+
next.agents[command.agentId] = {
|
|
38
|
+
...agent,
|
|
39
|
+
locationId: command.locationId,
|
|
40
|
+
direction: anchor.direction ?? agent.direction,
|
|
41
|
+
activity: { kind: "moving", toLocationId: command.locationId },
|
|
42
|
+
visibleText: undefined,
|
|
43
|
+
};
|
|
44
|
+
return next;
|
|
45
|
+
}
|
|
46
|
+
case "agent.work": {
|
|
47
|
+
const anchor = requireAnchor(next.scene, command.workstationId);
|
|
48
|
+
next.agents[command.agentId] = {
|
|
49
|
+
...agent,
|
|
50
|
+
locationId: command.workstationId,
|
|
51
|
+
direction: anchor.direction ?? agent.direction,
|
|
52
|
+
activity: { kind: "working", workstationId: command.workstationId },
|
|
53
|
+
visibleText: undefined,
|
|
54
|
+
};
|
|
55
|
+
return next;
|
|
56
|
+
}
|
|
57
|
+
case "agent.think": {
|
|
58
|
+
next.agents[command.agentId] = {
|
|
59
|
+
...agent,
|
|
60
|
+
activity: command.text === undefined ? { kind: "thinking" } : { kind: "thinking", text: command.text },
|
|
61
|
+
visibleText: command.text,
|
|
62
|
+
};
|
|
63
|
+
return next;
|
|
64
|
+
}
|
|
65
|
+
case "agent.talk": {
|
|
66
|
+
next.agents[command.agentId] = {
|
|
67
|
+
...agent,
|
|
68
|
+
activity: { kind: "talking", text: command.text },
|
|
69
|
+
visibleText: command.text,
|
|
70
|
+
};
|
|
71
|
+
return next;
|
|
72
|
+
}
|
|
73
|
+
case "agent.tool_call": {
|
|
74
|
+
next.agents[command.agentId] = {
|
|
75
|
+
...agent,
|
|
76
|
+
activity: { kind: "tool_call", toolName: command.toolName, status: command.status },
|
|
77
|
+
visibleText: `${command.toolName}: ${command.status}`,
|
|
78
|
+
};
|
|
79
|
+
return next;
|
|
80
|
+
}
|
|
81
|
+
case "agent.emote": {
|
|
82
|
+
next.agents[command.agentId] = {
|
|
83
|
+
...agent,
|
|
84
|
+
emotion: command.emotion,
|
|
85
|
+
};
|
|
86
|
+
return next;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function requireAgent(snapshot: AgentGameSnapshot, agentId: string): AgentGameAgent {
|
|
92
|
+
const agent = snapshot.agents[agentId];
|
|
93
|
+
if (!agent) {
|
|
94
|
+
throw new AgentGameError("missing_agent", `Agent game command references missing agent: ${agentId}`);
|
|
95
|
+
}
|
|
96
|
+
return agent;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function requireAnchor(scene: AgentGameSceneDefinition, anchorId: string) {
|
|
100
|
+
const anchor = findAgentGameAnchor(scene, anchorId);
|
|
101
|
+
if (!anchor) {
|
|
102
|
+
throw new AgentGameError("missing_anchor", `Agent game command references missing anchor: ${anchorId}`);
|
|
103
|
+
}
|
|
104
|
+
return anchor;
|
|
105
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { AgentGameError } from "./errors.js";
|
|
2
|
+
|
|
3
|
+
export type AgentGameDirection = "up" | "down" | "left" | "right";
|
|
4
|
+
export type AgentGameAnchorKind = "spawn" | "desk" | "meeting" | "break" | "living";
|
|
5
|
+
|
|
6
|
+
export type AgentGameAnchor = {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: AgentGameAnchorKind;
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
direction?: AgentGameDirection;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type AgentGameSceneDefinition = {
|
|
15
|
+
id: string;
|
|
16
|
+
map: {
|
|
17
|
+
key: string;
|
|
18
|
+
url: string;
|
|
19
|
+
tilesets: Array<{ key: string; imageUrl: string }>;
|
|
20
|
+
};
|
|
21
|
+
anchors: AgentGameAnchor[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type TiledMapLike = {
|
|
25
|
+
layers?: TiledLayerLike[];
|
|
26
|
+
tilesets?: TiledTilesetLike[];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type TiledLayerLike = {
|
|
30
|
+
type?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
objects?: TiledObjectLike[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type TiledObjectLike = {
|
|
36
|
+
name?: string;
|
|
37
|
+
type?: string;
|
|
38
|
+
x?: number;
|
|
39
|
+
y?: number;
|
|
40
|
+
properties?: Array<{ name?: string; value?: unknown }>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type TiledTilesetLike = {
|
|
44
|
+
name?: string;
|
|
45
|
+
image?: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type CreateAgentGameSceneFromTiledMapOptions = {
|
|
49
|
+
id: string;
|
|
50
|
+
mapUrl: string;
|
|
51
|
+
tiledMap: TiledMapLike;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export function validateAgentGameScene(scene: AgentGameSceneDefinition): AgentGameSceneDefinition {
|
|
55
|
+
assertNonEmpty(scene.id, "scene id");
|
|
56
|
+
assertNonEmpty(scene.map.key, "map key");
|
|
57
|
+
assertNonEmpty(scene.map.url, "map url");
|
|
58
|
+
|
|
59
|
+
const anchorIds = new Set<string>();
|
|
60
|
+
for (const anchor of scene.anchors) {
|
|
61
|
+
assertNonEmpty(anchor.id, "anchor id");
|
|
62
|
+
if (anchorIds.has(anchor.id)) {
|
|
63
|
+
throw new AgentGameError("invalid_scene", `Duplicate agent game anchor id: ${anchor.id}`);
|
|
64
|
+
}
|
|
65
|
+
anchorIds.add(anchor.id);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return scene;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function findAgentGameAnchor(scene: AgentGameSceneDefinition, anchorId: string): AgentGameAnchor | null {
|
|
72
|
+
return scene.anchors.find((anchor) => anchor.id === anchorId) ?? null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function createAgentGameSceneFromTiledMap(options: CreateAgentGameSceneFromTiledMapOptions): AgentGameSceneDefinition {
|
|
76
|
+
const anchors: AgentGameAnchor[] = [];
|
|
77
|
+
for (const layer of options.tiledMap.layers ?? []) {
|
|
78
|
+
if (layer.type !== "objectgroup") {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
for (const object of layer.objects ?? []) {
|
|
82
|
+
if (!object.name || !object.type || object.x === undefined || object.y === undefined) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
anchors.push({
|
|
86
|
+
id: object.name,
|
|
87
|
+
kind: parseAnchorKind(object.type),
|
|
88
|
+
x: object.x,
|
|
89
|
+
y: object.y,
|
|
90
|
+
direction: parseOptionalDirection(object.properties),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return validateAgentGameScene({
|
|
96
|
+
id: options.id,
|
|
97
|
+
map: {
|
|
98
|
+
key: options.id,
|
|
99
|
+
url: options.mapUrl,
|
|
100
|
+
tilesets: (options.tiledMap.tilesets ?? []).map((tileset) => ({
|
|
101
|
+
key: requireTilesetField(tileset.name, "tileset name"),
|
|
102
|
+
imageUrl: requireTilesetField(tileset.image, "tileset image"),
|
|
103
|
+
})),
|
|
104
|
+
},
|
|
105
|
+
anchors,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function parseAnchorKind(value: string): AgentGameAnchorKind {
|
|
110
|
+
switch (value) {
|
|
111
|
+
case "spawn":
|
|
112
|
+
case "desk":
|
|
113
|
+
case "meeting":
|
|
114
|
+
case "break":
|
|
115
|
+
case "living":
|
|
116
|
+
return value;
|
|
117
|
+
default:
|
|
118
|
+
throw new AgentGameError("invalid_scene", `Unsupported agent game anchor kind: ${value}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function parseOptionalDirection(properties: TiledObjectLike["properties"]): AgentGameDirection | undefined {
|
|
123
|
+
const value = properties?.find((property) => property.name === "direction")?.value;
|
|
124
|
+
if (value === undefined) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
if (value === "up" || value === "down" || value === "left" || value === "right") {
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
throw new AgentGameError("invalid_scene", `Unsupported agent game direction: ${String(value)}`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function requireTilesetField(value: string | undefined, field: string): string {
|
|
134
|
+
if (!value) {
|
|
135
|
+
throw new AgentGameError("invalid_scene", `Agent game ${field} must not be empty`);
|
|
136
|
+
}
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function assertNonEmpty(value: string, field: string): void {
|
|
141
|
+
if (value.trim().length === 0) {
|
|
142
|
+
throw new AgentGameError("invalid_scene", `Agent game ${field} must not be empty`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgentGameCommand } from "./commands.js";
|
|
2
|
+
|
|
3
|
+
export type OfficeWorkdaySequenceOptions = {
|
|
4
|
+
agentId: string;
|
|
5
|
+
workstationId: string;
|
|
6
|
+
meetingSpotId: string;
|
|
7
|
+
breakSpotId: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function createOfficeWorkdaySequence(options: OfficeWorkdaySequenceOptions): AgentGameCommand[] {
|
|
11
|
+
return [
|
|
12
|
+
{ type: "agent.work", agentId: options.agentId, workstationId: options.workstationId },
|
|
13
|
+
{ type: "agent.think", agentId: options.agentId, text: "Preparing meeting notes" },
|
|
14
|
+
{ type: "agent.move", agentId: options.agentId, locationId: options.meetingSpotId },
|
|
15
|
+
{ type: "agent.talk", agentId: options.agentId, text: "Joining the meeting." },
|
|
16
|
+
{ type: "agent.move", agentId: options.agentId, locationId: options.breakSpotId },
|
|
17
|
+
{ type: "agent.think", agentId: options.agentId, text: "Taking a short break" },
|
|
18
|
+
{ type: "agent.work", agentId: options.agentId, workstationId: options.workstationId },
|
|
19
|
+
];
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AgentGameCommand } from "./commands.js";
|
|
2
|
+
|
|
3
|
+
export type PlayAgentGameSequenceOptions = {
|
|
4
|
+
dispatch: (command: AgentGameCommand) => void;
|
|
5
|
+
delayMs?: number;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type PlayAgentGameSequenceResult = {
|
|
10
|
+
completed: boolean;
|
|
11
|
+
dispatchedCount: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export async function playAgentGameSequence(
|
|
15
|
+
commands: readonly AgentGameCommand[],
|
|
16
|
+
options: PlayAgentGameSequenceOptions,
|
|
17
|
+
): Promise<PlayAgentGameSequenceResult> {
|
|
18
|
+
let dispatchedCount = 0;
|
|
19
|
+
|
|
20
|
+
for (const command of commands) {
|
|
21
|
+
if (options.signal?.aborted) {
|
|
22
|
+
return { completed: false, dispatchedCount };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
options.dispatch(command);
|
|
26
|
+
dispatchedCount += 1;
|
|
27
|
+
|
|
28
|
+
if (options.signal?.aborted) {
|
|
29
|
+
return { completed: false, dispatchedCount };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (options.delayMs && options.delayMs > 0) {
|
|
33
|
+
await delay(options.delayMs, options.signal);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return { completed: true, dispatchedCount };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function delay(ms: number, signal?: AbortSignal): Promise<void> {
|
|
41
|
+
return new Promise((resolve) => {
|
|
42
|
+
const timeout = setTimeout(resolve, ms);
|
|
43
|
+
signal?.addEventListener("abort", () => {
|
|
44
|
+
clearTimeout(timeout);
|
|
45
|
+
resolve();
|
|
46
|
+
}, { once: true });
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AgentGameEmotion, AgentToolCallStatus } from "./commands.js";
|
|
2
|
+
import type { AgentGameDirection, AgentGameSceneDefinition } from "./scene.js";
|
|
3
|
+
|
|
4
|
+
export type AgentGameActivity =
|
|
5
|
+
| { kind: "idle" }
|
|
6
|
+
| { kind: "moving"; toLocationId: string }
|
|
7
|
+
| { kind: "working"; workstationId: string }
|
|
8
|
+
| { kind: "thinking"; text?: string }
|
|
9
|
+
| { kind: "talking"; text: string }
|
|
10
|
+
| { kind: "tool_call"; toolName: string; status: AgentToolCallStatus };
|
|
11
|
+
|
|
12
|
+
export type AgentGameAgent = {
|
|
13
|
+
agentId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
avatarId: string;
|
|
16
|
+
locationId: string;
|
|
17
|
+
direction: AgentGameDirection;
|
|
18
|
+
activity: AgentGameActivity;
|
|
19
|
+
emotion?: AgentGameEmotion;
|
|
20
|
+
visibleText?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type AgentGameSnapshot = {
|
|
24
|
+
scene: AgentGameSceneDefinition;
|
|
25
|
+
agents: Record<string, AgentGameAgent>;
|
|
26
|
+
};
|