totemlayer 0.1.21 → 0.1.25
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 +34 -32
- package/bin/agent-runner.mjs +27 -2
- package/bin/agent-setup.mjs +33 -6
- package/bin/automatic-runtime.mjs +105 -9
- package/bin/bound-login.mjs +107 -0
- package/bin/connected-agent-service.mjs +119 -78
- package/bin/device-login.mjs +108 -9
- package/bin/installation.mjs +175 -76
- package/bin/mission-agent-service.mjs +23 -5
- package/bin/mission-coordination.mjs +311 -0
- package/bin/mission-worker.mjs +271 -20
- package/bin/model-adapter.mjs +30 -8
- package/bin/network-runtime.mjs +115 -15
- package/bin/runtime-diagnostics.mjs +4 -0
- package/bin/runtime-installation.mjs +1 -0
- package/bin/sdk/action-types.d.ts +236 -0
- package/bin/sdk/actions.d.ts +19 -0
- package/bin/sdk/errors.d.ts +30 -0
- package/bin/sdk/errors.js +14 -1
- package/bin/sdk/index.d.ts +300 -0
- package/bin/sdk/index.js +57 -11
- package/bin/sdk/inspector.d.ts +40 -0
- package/bin/sdk/request-options.d.ts +13 -0
- package/bin/sdk/transport.d.ts +24 -0
- package/bin/sdk/types.d.ts +640 -0
- package/bin/totem.mjs +2 -2
- package/package.json +1 -1
- package/scripts/prepare.mjs +9 -20
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
export type Metadata = Record<string, unknown>;
|
|
2
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
/** Server-derived discovery links; no registry status or execution authority is implied. */
|
|
6
|
+
export interface Erc8004DiscoveryLinks {
|
|
7
|
+
registrationPath: string;
|
|
8
|
+
identityPath: string;
|
|
9
|
+
grantsActionAuthority: false;
|
|
10
|
+
}
|
|
11
|
+
export interface Agent {
|
|
12
|
+
/** Authenticated connection-only listener marker; not an authority claim from a peer. */
|
|
13
|
+
listenerConnectionId?: string;
|
|
14
|
+
id: string;
|
|
15
|
+
address: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string | null;
|
|
18
|
+
organization: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
verified: boolean;
|
|
23
|
+
/** Portable registry evidence; never a company verification badge or execution grant. */
|
|
24
|
+
erc8004?: Erc8004DiscoveryLinks;
|
|
25
|
+
environment: "SANDBOX" | "PRODUCTION";
|
|
26
|
+
capabilities: string[];
|
|
27
|
+
skills: string[];
|
|
28
|
+
tags: string[];
|
|
29
|
+
protocols: string[];
|
|
30
|
+
status: "ACTIVE" | "SUSPENDED" | "REVOKED" | "OFFLINE";
|
|
31
|
+
inputModes: string[];
|
|
32
|
+
outputModes: string[];
|
|
33
|
+
publicMetadata: Metadata;
|
|
34
|
+
communicationPolicy: {
|
|
35
|
+
mode: "public" | "verified_only" | "approved_organizations" | "allowlist" | "private";
|
|
36
|
+
};
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
lastSeenAt: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface TextContent {
|
|
42
|
+
type: "text";
|
|
43
|
+
text: string;
|
|
44
|
+
/** Upload these IDs first; an attachment can be bound to one message only. */
|
|
45
|
+
attachments?: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface Attachment {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
mediaType: string;
|
|
51
|
+
size: number;
|
|
52
|
+
sha256: string;
|
|
53
|
+
}
|
|
54
|
+
export interface JsonContent {
|
|
55
|
+
type: "json";
|
|
56
|
+
data: JsonValue;
|
|
57
|
+
}
|
|
58
|
+
export type MessageContent = TextContent | JsonContent | import("./e2ee-wire.js").EncryptedContent;
|
|
59
|
+
export type MessageState = "accepted" | "delivered" | "acknowledged" | "responded" | "failed" | "rejected" | "expired";
|
|
60
|
+
export interface Message {
|
|
61
|
+
id: string;
|
|
62
|
+
sequence: string;
|
|
63
|
+
from: string;
|
|
64
|
+
to: string;
|
|
65
|
+
verified: boolean;
|
|
66
|
+
sandbox: boolean;
|
|
67
|
+
content: MessageContent;
|
|
68
|
+
attachments?: Attachment[];
|
|
69
|
+
conversationId: string;
|
|
70
|
+
taskId: string | null;
|
|
71
|
+
inReplyToId: string | null;
|
|
72
|
+
hopCount: number;
|
|
73
|
+
state: MessageState;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
expiresAt: string;
|
|
76
|
+
deliveredAt: string | null;
|
|
77
|
+
readAt: string | null;
|
|
78
|
+
metadata: Metadata | null;
|
|
79
|
+
authorization: {
|
|
80
|
+
context: {
|
|
81
|
+
grantId: string;
|
|
82
|
+
action: string;
|
|
83
|
+
resource: string;
|
|
84
|
+
};
|
|
85
|
+
verified: false;
|
|
86
|
+
} | null;
|
|
87
|
+
}
|
|
88
|
+
export interface Conversation {
|
|
89
|
+
id: string;
|
|
90
|
+
participants: Array<{
|
|
91
|
+
id: string;
|
|
92
|
+
address: string;
|
|
93
|
+
}>;
|
|
94
|
+
status: string;
|
|
95
|
+
createdAt: string;
|
|
96
|
+
metadata: Metadata | null;
|
|
97
|
+
}
|
|
98
|
+
export type TaskState = "submitted" | "working" | "input_required" | "completed" | "failed" | "canceled" | "rejected";
|
|
99
|
+
export interface Task {
|
|
100
|
+
id: string;
|
|
101
|
+
conversationId: string;
|
|
102
|
+
requesterId: string;
|
|
103
|
+
assigneeId: string;
|
|
104
|
+
state: TaskState;
|
|
105
|
+
createdAt: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
version: number;
|
|
108
|
+
metadata: Metadata | null;
|
|
109
|
+
artifacts: JsonValue[];
|
|
110
|
+
repoClaims?: RepoClaim[];
|
|
111
|
+
events?: Array<{
|
|
112
|
+
id: string;
|
|
113
|
+
taskId: string;
|
|
114
|
+
state: TaskState;
|
|
115
|
+
sequence: string;
|
|
116
|
+
metadata: Metadata;
|
|
117
|
+
createdAt: string;
|
|
118
|
+
}>;
|
|
119
|
+
}
|
|
120
|
+
export type RepoClaimState = "planned" | "working" | "submitted" | "released";
|
|
121
|
+
export interface RepoClaim {
|
|
122
|
+
id: string;
|
|
123
|
+
taskId: string;
|
|
124
|
+
agentId: string;
|
|
125
|
+
repository: string;
|
|
126
|
+
baseCommit: string;
|
|
127
|
+
branch: string;
|
|
128
|
+
paths: string[];
|
|
129
|
+
state: RepoClaimState;
|
|
130
|
+
headCommit: string | null;
|
|
131
|
+
pullRequestUrl: string | null;
|
|
132
|
+
version: number;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
updatedAt: string;
|
|
135
|
+
}
|
|
136
|
+
export interface RepositoryCoordination {
|
|
137
|
+
taskId: string;
|
|
138
|
+
repository: string;
|
|
139
|
+
baseCommit: string;
|
|
140
|
+
baseBranch: string | null;
|
|
141
|
+
claims: RepoClaim[];
|
|
142
|
+
}
|
|
143
|
+
export type MissionStatus = "active" | "paused" | "waiting_for_input" | "completed" | "failed" | "canceled";
|
|
144
|
+
export interface MissionSummary {
|
|
145
|
+
id: string;
|
|
146
|
+
goal: string;
|
|
147
|
+
desiredOutput: string;
|
|
148
|
+
lifetime?: "task_scoped" | "ongoing";
|
|
149
|
+
status: MissionStatus;
|
|
150
|
+
role?: string;
|
|
151
|
+
coordinatorMemberId: string | null;
|
|
152
|
+
coordinatorAgentId?: string | null;
|
|
153
|
+
deadlineAt: string | null;
|
|
154
|
+
repository: {
|
|
155
|
+
url: string;
|
|
156
|
+
baseRevision: string;
|
|
157
|
+
} | null;
|
|
158
|
+
activeAgentLimit: number;
|
|
159
|
+
spendingLimitCents: number;
|
|
160
|
+
spentCents: number;
|
|
161
|
+
reservedCents?: number;
|
|
162
|
+
}
|
|
163
|
+
/** A bounded discovery sweep. Restart without a cursor after exhaustion to see changed eligibility. */
|
|
164
|
+
export interface ListMissions extends Pagination {
|
|
165
|
+
status?: MissionStatus;
|
|
166
|
+
}
|
|
167
|
+
/** Context for the authenticated Company Brain or personal assistant. */
|
|
168
|
+
export interface AssistantContext {
|
|
169
|
+
version: 1;
|
|
170
|
+
agent: {
|
|
171
|
+
id: string;
|
|
172
|
+
identityAgentId: string;
|
|
173
|
+
address: string;
|
|
174
|
+
name: string;
|
|
175
|
+
organizationId: string;
|
|
176
|
+
environment: "SANDBOX" | "PRODUCTION";
|
|
177
|
+
erc8004?: Erc8004DiscoveryLinks;
|
|
178
|
+
};
|
|
179
|
+
network: {
|
|
180
|
+
conversationCount: number;
|
|
181
|
+
unreadMessageCount: number;
|
|
182
|
+
conversations: Array<{
|
|
183
|
+
id: string;
|
|
184
|
+
status: string;
|
|
185
|
+
updatedAt: string;
|
|
186
|
+
participants: Array<{
|
|
187
|
+
id: string;
|
|
188
|
+
address: string;
|
|
189
|
+
}>;
|
|
190
|
+
}>;
|
|
191
|
+
};
|
|
192
|
+
missions: MissionSummary[];
|
|
193
|
+
/** Ongoing missions first, followed by recent finished work, bounded to 100. */
|
|
194
|
+
missionSnapshot?: {
|
|
195
|
+
total: number;
|
|
196
|
+
visible: number;
|
|
197
|
+
truncated: boolean;
|
|
198
|
+
};
|
|
199
|
+
invitations: Array<{
|
|
200
|
+
missionId: string;
|
|
201
|
+
goal: string;
|
|
202
|
+
role: string;
|
|
203
|
+
memberId: string;
|
|
204
|
+
consentUrl: string;
|
|
205
|
+
}>;
|
|
206
|
+
authorization: {
|
|
207
|
+
networkCredentialGrantsActions: false;
|
|
208
|
+
actionChecksRequireSeparateCredential: true;
|
|
209
|
+
missionPermissionsRequireHumanConsent: true;
|
|
210
|
+
missionPermissionsRecheckedAtDispatch: true;
|
|
211
|
+
checksUrl: "/checks";
|
|
212
|
+
};
|
|
213
|
+
/** Capability snapshot only; every check and execution revalidates authority. */
|
|
214
|
+
capabilities: {
|
|
215
|
+
actionChecks: {
|
|
216
|
+
supportedAdapters: Array<"NOOP_READ" | "LOOPBACK_ECHO">;
|
|
217
|
+
requiresVerifiedOrganization: true;
|
|
218
|
+
organizationVerified: boolean;
|
|
219
|
+
repositoryEffectsSupported: false;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
links: {
|
|
223
|
+
network: "/communications";
|
|
224
|
+
trustNetwork: "/network";
|
|
225
|
+
missions: "/missions";
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** Advisory permission snapshot; dispatch always rechecks live authority. */
|
|
229
|
+
export interface AssistantMissionPermissions {
|
|
230
|
+
version: 1;
|
|
231
|
+
agentId: string;
|
|
232
|
+
missionId: string;
|
|
233
|
+
memberId: string;
|
|
234
|
+
status: MissionStatus;
|
|
235
|
+
deadlineAt: string | null;
|
|
236
|
+
permissions: Array<{
|
|
237
|
+
id: string;
|
|
238
|
+
action: string;
|
|
239
|
+
resource: string;
|
|
240
|
+
environment: "SANDBOX" | "PRODUCTION";
|
|
241
|
+
createdAt: string;
|
|
242
|
+
}>;
|
|
243
|
+
authorization: {
|
|
244
|
+
advisory: true;
|
|
245
|
+
recheckedAtDispatch: true;
|
|
246
|
+
networkCredentialGrantsActions: false;
|
|
247
|
+
actionChecksRequireSeparateCredential: true;
|
|
248
|
+
};
|
|
249
|
+
links: {
|
|
250
|
+
mission: string;
|
|
251
|
+
checks: "/checks";
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
export interface MissionWorkItem {
|
|
255
|
+
id: string;
|
|
256
|
+
missionId: string;
|
|
257
|
+
ownerMemberId: string;
|
|
258
|
+
objective: string;
|
|
259
|
+
requiredOutput: string;
|
|
260
|
+
state: "queued" | "claimed" | "blocked" | "completed" | "failed" | "canceled";
|
|
261
|
+
dependsOnIds: string[];
|
|
262
|
+
deadlineAt: string | null;
|
|
263
|
+
timeoutSeconds: number | null;
|
|
264
|
+
attempts: number;
|
|
265
|
+
maxAttempts: number;
|
|
266
|
+
leaseExpired?: boolean;
|
|
267
|
+
metadata: Metadata;
|
|
268
|
+
repository?: {
|
|
269
|
+
url: string;
|
|
270
|
+
baseRevision: string;
|
|
271
|
+
} | null;
|
|
272
|
+
result?: Metadata | null;
|
|
273
|
+
}
|
|
274
|
+
export interface MissionArtifact {
|
|
275
|
+
id: string;
|
|
276
|
+
missionId: string;
|
|
277
|
+
kind: string;
|
|
278
|
+
title: string;
|
|
279
|
+
summary: string | null;
|
|
280
|
+
uri: string | null;
|
|
281
|
+
contentText?: string | null;
|
|
282
|
+
metadata: Metadata;
|
|
283
|
+
createdAt: string;
|
|
284
|
+
}
|
|
285
|
+
export interface MissionDetail extends Omit<MissionSummary, "activeAgentLimit" | "spendingLimitCents" | "spentCents" | "reservedCents"> {
|
|
286
|
+
ownerUserId?: string;
|
|
287
|
+
owner?: {
|
|
288
|
+
name: string;
|
|
289
|
+
organization: string;
|
|
290
|
+
};
|
|
291
|
+
organizationId?: string;
|
|
292
|
+
pendingApprovalKind?: string | null;
|
|
293
|
+
approvalDecisions?: string[];
|
|
294
|
+
permittedConnectorActions?: string[];
|
|
295
|
+
infrastructure?: {
|
|
296
|
+
provider: "local-static";
|
|
297
|
+
sourceDirectory: string;
|
|
298
|
+
executorAgentId: string;
|
|
299
|
+
} | null;
|
|
300
|
+
budget: {
|
|
301
|
+
spendingLimitCents: number;
|
|
302
|
+
spentCents: number;
|
|
303
|
+
reservedCents: number;
|
|
304
|
+
activeAgentLimit: number;
|
|
305
|
+
maxEvents: number;
|
|
306
|
+
eventCount: number;
|
|
307
|
+
maxDelegationDepth: number;
|
|
308
|
+
maxWorkItems: number;
|
|
309
|
+
workItemCount: number;
|
|
310
|
+
};
|
|
311
|
+
members: Array<{
|
|
312
|
+
id: string;
|
|
313
|
+
agentId: string;
|
|
314
|
+
role: string;
|
|
315
|
+
status: "invited" | "active" | "declined" | "removed";
|
|
316
|
+
ownerUserId: string;
|
|
317
|
+
historyFromSequence: string;
|
|
318
|
+
agent: {
|
|
319
|
+
id: string;
|
|
320
|
+
name: string;
|
|
321
|
+
address: string;
|
|
322
|
+
status: string;
|
|
323
|
+
organization: {
|
|
324
|
+
id: string;
|
|
325
|
+
name: string;
|
|
326
|
+
};
|
|
327
|
+
erc8004?: Erc8004DiscoveryLinks;
|
|
328
|
+
runtime: {
|
|
329
|
+
connected: boolean;
|
|
330
|
+
ready: boolean;
|
|
331
|
+
state: string;
|
|
332
|
+
lastSeenAt: string | null;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
}>;
|
|
336
|
+
workItems: MissionWorkItem[];
|
|
337
|
+
artifacts: MissionArtifact[];
|
|
338
|
+
events: MissionEvent[];
|
|
339
|
+
coordination?: MissionCoordination;
|
|
340
|
+
}
|
|
341
|
+
export interface MissionSessionObservation {
|
|
342
|
+
status: "complete" | "truncated" | "unavailable";
|
|
343
|
+
baseRevision: string;
|
|
344
|
+
headCommit: string | null;
|
|
345
|
+
branch: string | null;
|
|
346
|
+
paths: string[];
|
|
347
|
+
}
|
|
348
|
+
export interface MissionSessionReport {
|
|
349
|
+
sessionId: string;
|
|
350
|
+
workItemId: string;
|
|
351
|
+
leaseToken: string;
|
|
352
|
+
sequence: number;
|
|
353
|
+
state: "running" | "completed" | "failed";
|
|
354
|
+
provider: "qwen-local" | "ollama-local" | "nim-local" | "codex" | "claude" | "command" | "http";
|
|
355
|
+
phase: "preparing" | "generating" | "checking" | "committing" | "settling" | "finished";
|
|
356
|
+
observation: MissionSessionObservation | null;
|
|
357
|
+
}
|
|
358
|
+
export interface SharedMissionSession {
|
|
359
|
+
id: string;
|
|
360
|
+
agentId: string;
|
|
361
|
+
memberId: string;
|
|
362
|
+
workItemId: string;
|
|
363
|
+
attempt: number;
|
|
364
|
+
provider: string;
|
|
365
|
+
stage: string;
|
|
366
|
+
phase: string;
|
|
367
|
+
state: string;
|
|
368
|
+
connected: boolean;
|
|
369
|
+
inactiveReason?: string | null;
|
|
370
|
+
repository: string | null;
|
|
371
|
+
observation: MissionSessionObservation | null;
|
|
372
|
+
lastSeenAt: string;
|
|
373
|
+
activities: Array<{
|
|
374
|
+
sequence: number;
|
|
375
|
+
phase: string;
|
|
376
|
+
state: string;
|
|
377
|
+
at: string;
|
|
378
|
+
}>;
|
|
379
|
+
}
|
|
380
|
+
export interface MissionOverlap {
|
|
381
|
+
id: string;
|
|
382
|
+
sessionIds: [string, string];
|
|
383
|
+
agentIds: [string, string];
|
|
384
|
+
paths: string[];
|
|
385
|
+
totalPaths?: number;
|
|
386
|
+
}
|
|
387
|
+
export interface MissionCoordination {
|
|
388
|
+
sessionsTruncated?: boolean;
|
|
389
|
+
overlapsTruncated?: boolean;
|
|
390
|
+
version: string;
|
|
391
|
+
briefing: string;
|
|
392
|
+
sessions: SharedMissionSession[];
|
|
393
|
+
overlaps: MissionOverlap[];
|
|
394
|
+
}
|
|
395
|
+
export interface MissionCoordinationUpdate {
|
|
396
|
+
version: string;
|
|
397
|
+
changed: boolean;
|
|
398
|
+
briefing: string | null;
|
|
399
|
+
overlaps: MissionOverlap[];
|
|
400
|
+
ownerClarifications?: Array<{
|
|
401
|
+
id: string;
|
|
402
|
+
sequence: string;
|
|
403
|
+
type: string;
|
|
404
|
+
payload: unknown;
|
|
405
|
+
}> | null;
|
|
406
|
+
}
|
|
407
|
+
export type MissionEventInput = {
|
|
408
|
+
version: 1;
|
|
409
|
+
workItemId?: string;
|
|
410
|
+
artifactIds?: string[];
|
|
411
|
+
recipientMemberIds?: string[];
|
|
412
|
+
} & ({
|
|
413
|
+
type: "message";
|
|
414
|
+
payload: {
|
|
415
|
+
text: string;
|
|
416
|
+
};
|
|
417
|
+
} | {
|
|
418
|
+
type: "proposal";
|
|
419
|
+
payload: {
|
|
420
|
+
title: string;
|
|
421
|
+
problem: string;
|
|
422
|
+
approach?: string;
|
|
423
|
+
candidates?: Array<{
|
|
424
|
+
title: string;
|
|
425
|
+
problem: string;
|
|
426
|
+
approach?: string;
|
|
427
|
+
}>;
|
|
428
|
+
};
|
|
429
|
+
} | {
|
|
430
|
+
type: "review";
|
|
431
|
+
payload: {
|
|
432
|
+
summary: string;
|
|
433
|
+
verdict: "feasible" | "approved" | "changes_required" | "rejected";
|
|
434
|
+
findings?: string[];
|
|
435
|
+
candidateTitle?: string;
|
|
436
|
+
};
|
|
437
|
+
} | {
|
|
438
|
+
type: "decision";
|
|
439
|
+
payload: {
|
|
440
|
+
title: string;
|
|
441
|
+
outcome: string;
|
|
442
|
+
rationale?: string;
|
|
443
|
+
selected?: boolean;
|
|
444
|
+
selectedCandidateTitle?: string;
|
|
445
|
+
};
|
|
446
|
+
} | {
|
|
447
|
+
type: "assignment";
|
|
448
|
+
payload: {
|
|
449
|
+
objective: string;
|
|
450
|
+
requiredOutput?: string;
|
|
451
|
+
};
|
|
452
|
+
} | {
|
|
453
|
+
type: "progress";
|
|
454
|
+
payload: {
|
|
455
|
+
summary: string;
|
|
456
|
+
percent?: number;
|
|
457
|
+
};
|
|
458
|
+
} | {
|
|
459
|
+
type: "blocker";
|
|
460
|
+
payload: {
|
|
461
|
+
summary: string;
|
|
462
|
+
helpNeeded?: string;
|
|
463
|
+
};
|
|
464
|
+
} | {
|
|
465
|
+
type: "question";
|
|
466
|
+
payload: {
|
|
467
|
+
question: string;
|
|
468
|
+
};
|
|
469
|
+
} | {
|
|
470
|
+
type: "artifact";
|
|
471
|
+
payload: {
|
|
472
|
+
title: string;
|
|
473
|
+
summary?: string;
|
|
474
|
+
};
|
|
475
|
+
} | {
|
|
476
|
+
type: "completion";
|
|
477
|
+
payload: {
|
|
478
|
+
summary: string;
|
|
479
|
+
result: "completed" | "failed";
|
|
480
|
+
};
|
|
481
|
+
});
|
|
482
|
+
export interface MissionEvent {
|
|
483
|
+
id: string;
|
|
484
|
+
missionId: string;
|
|
485
|
+
sequence: string;
|
|
486
|
+
version: 1 | null;
|
|
487
|
+
type: string;
|
|
488
|
+
payload: Metadata;
|
|
489
|
+
workItemId: string | null;
|
|
490
|
+
artifactIds: string[];
|
|
491
|
+
actor: {
|
|
492
|
+
kind: "human" | "agent" | "system";
|
|
493
|
+
id: string | null;
|
|
494
|
+
address?: string;
|
|
495
|
+
};
|
|
496
|
+
recipientMemberIds: string[];
|
|
497
|
+
createdAt: string;
|
|
498
|
+
deliveredAt?: string | null;
|
|
499
|
+
readAt?: string | null;
|
|
500
|
+
}
|
|
501
|
+
export interface Page<T> {
|
|
502
|
+
data: T[];
|
|
503
|
+
nextCursor?: string | null;
|
|
504
|
+
}
|
|
505
|
+
export interface Pagination {
|
|
506
|
+
cursor?: string;
|
|
507
|
+
limit?: number;
|
|
508
|
+
}
|
|
509
|
+
export interface SearchAgents extends Pagination {
|
|
510
|
+
q?: string;
|
|
511
|
+
organization?: string;
|
|
512
|
+
capability?: string;
|
|
513
|
+
skill?: string;
|
|
514
|
+
tag?: string;
|
|
515
|
+
protocol?: string;
|
|
516
|
+
verified?: boolean;
|
|
517
|
+
environment?: "SANDBOX" | "PRODUCTION";
|
|
518
|
+
}
|
|
519
|
+
export interface ListMessages extends Pagination {
|
|
520
|
+
unread?: boolean;
|
|
521
|
+
direction?: "inbound" | "outbound" | "all";
|
|
522
|
+
from?: string;
|
|
523
|
+
state?: MessageState;
|
|
524
|
+
conversationId?: string;
|
|
525
|
+
taskId?: string;
|
|
526
|
+
}
|
|
527
|
+
export interface ListTasks extends Pagination {
|
|
528
|
+
role?: "requester" | "assignee" | "all";
|
|
529
|
+
state?: TaskState;
|
|
530
|
+
conversationId?: string;
|
|
531
|
+
}
|
|
532
|
+
/** A sender is always derived from the API key. There is deliberately no `from`. */
|
|
533
|
+
export type SendMessage = {
|
|
534
|
+
to: string;
|
|
535
|
+
conversationId?: string;
|
|
536
|
+
taskId?: string;
|
|
537
|
+
metadata?: Metadata;
|
|
538
|
+
ttlSeconds?: number;
|
|
539
|
+
authorization?: {
|
|
540
|
+
grantId: string;
|
|
541
|
+
action: string;
|
|
542
|
+
resource: string;
|
|
543
|
+
};
|
|
544
|
+
} & ({
|
|
545
|
+
text: string;
|
|
546
|
+
content?: never;
|
|
547
|
+
message?: never;
|
|
548
|
+
} | {
|
|
549
|
+
content: MessageContent;
|
|
550
|
+
text?: never;
|
|
551
|
+
message?: never;
|
|
552
|
+
} | {
|
|
553
|
+
message: string;
|
|
554
|
+
text?: never;
|
|
555
|
+
content?: never;
|
|
556
|
+
});
|
|
557
|
+
export interface RequestOptions {
|
|
558
|
+
signal?: AbortSignal;
|
|
559
|
+
}
|
|
560
|
+
export interface WriteOptions extends RequestOptions {
|
|
561
|
+
/** Reuse this key when retrying the same logical operation across restarts. */
|
|
562
|
+
idempotencyKey?: string;
|
|
563
|
+
}
|
|
564
|
+
export interface TotemOptions {
|
|
565
|
+
apiKey: string;
|
|
566
|
+
/** Server origin, for example http://127.0.0.1:3000 for local development. */
|
|
567
|
+
baseUrl?: string;
|
|
568
|
+
/** Optional identity assertion checked by connect(), never used as the sender. */
|
|
569
|
+
address?: string;
|
|
570
|
+
timeoutMs?: number;
|
|
571
|
+
maxRetries?: number;
|
|
572
|
+
retryDelayMs?: number;
|
|
573
|
+
fetch?: typeof globalThis.fetch;
|
|
574
|
+
}
|
|
575
|
+
export interface IncomingMessage extends Message {
|
|
576
|
+
text: string;
|
|
577
|
+
/** Stable keys make replaying the same handler's replies safe. */
|
|
578
|
+
reply(text: string, options?: WriteOptions): Promise<Message>;
|
|
579
|
+
ack(): Promise<Message>;
|
|
580
|
+
}
|
|
581
|
+
export type MessageHandler = (message: IncomingMessage) => void | Promise<void>;
|
|
582
|
+
export interface ListenOptions {
|
|
583
|
+
/** Customer-side policy. Screens message/file plaintext before invoking the handler. */
|
|
584
|
+
inspector?: import("./inspector.js").LocalInspector;
|
|
585
|
+
pollIntervalMs?: number;
|
|
586
|
+
/** Receives handler and transport failures; polling continues afterward. */
|
|
587
|
+
onError?: (error: Error) => void;
|
|
588
|
+
}
|
|
589
|
+
export interface Subscription {
|
|
590
|
+
/** Abort polling and wait for the currently running handler to finish. */
|
|
591
|
+
stop(): Promise<void>;
|
|
592
|
+
done: Promise<void>;
|
|
593
|
+
}
|
|
594
|
+
/** Human-origin commands are distinct from network messages and never impersonate an agent. */
|
|
595
|
+
export interface Chat {
|
|
596
|
+
id: string;
|
|
597
|
+
agentId: string;
|
|
598
|
+
title: string;
|
|
599
|
+
createdAt: string;
|
|
600
|
+
updatedAt: string;
|
|
601
|
+
}
|
|
602
|
+
export interface ChatEvent {
|
|
603
|
+
id: string;
|
|
604
|
+
sequence: string;
|
|
605
|
+
actor: "human" | "agent" | "system";
|
|
606
|
+
kind: "message" | "update";
|
|
607
|
+
text: string;
|
|
608
|
+
createdAt: string;
|
|
609
|
+
runId?: string | null;
|
|
610
|
+
}
|
|
611
|
+
export interface ChatRun {
|
|
612
|
+
id: string;
|
|
613
|
+
commandEventId: string;
|
|
614
|
+
state: "queued" | "running" | "completed" | "failed" | "canceled";
|
|
615
|
+
error?: string | null;
|
|
616
|
+
createdAt: string;
|
|
617
|
+
updatedAt: string;
|
|
618
|
+
leaseExpiresAt?: string | null;
|
|
619
|
+
}
|
|
620
|
+
export interface ChatCommand {
|
|
621
|
+
id: string;
|
|
622
|
+
chatId: string;
|
|
623
|
+
commandEventId: string;
|
|
624
|
+
text: string;
|
|
625
|
+
createdAt: string;
|
|
626
|
+
}
|
|
627
|
+
export interface ChatDetail {
|
|
628
|
+
chat: Chat;
|
|
629
|
+
events: ChatEvent[];
|
|
630
|
+
runs: ChatRun[];
|
|
631
|
+
nextCursor?: string;
|
|
632
|
+
hasMore?: boolean;
|
|
633
|
+
previousCursor?: string | null;
|
|
634
|
+
}
|
|
635
|
+
export interface RuntimeHeartbeat {
|
|
636
|
+
ready?: boolean;
|
|
637
|
+
state?: string;
|
|
638
|
+
connected: boolean;
|
|
639
|
+
lastSeenAt: string;
|
|
640
|
+
}
|
package/bin/totem.mjs
CHANGED
|
@@ -237,9 +237,9 @@ function compactDigest(value) {
|
|
|
237
237
|
function help() {
|
|
238
238
|
writeBrand();
|
|
239
239
|
writeHelpBody(`Start here
|
|
240
|
-
Install once npm install --global totemlayer
|
|
240
|
+
Install once npm install --global totemlayer@0.1.25
|
|
241
241
|
Confirm installation totem --version
|
|
242
|
-
Run one-off npx --yes totemlayer --help
|
|
242
|
+
Run one-off npx --yes --package=totemlayer@0.1.25 totem --help
|
|
243
243
|
|
|
244
244
|
Connect once and receive messages and approved Mission work
|
|
245
245
|
Select Codex, Claude, a local model, or an owner-configured CLI/HTTP agent.
|
package/package.json
CHANGED
package/scripts/prepare.mjs
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
await mkdir(destination, { recursive: true });
|
|
12
|
-
for (const name of await readdir(new URL("../../sdk/dist/", import.meta.url))) {
|
|
13
|
-
if (name.endsWith(".js"))
|
|
14
|
-
await copyFile(new URL(`../../sdk/dist/${name}`, import.meta.url), new URL(name, destination));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const workerCore = new URL("../bin/worker-core/", import.meta.url);
|
|
18
|
-
await mkdir(workerCore, { recursive: true });
|
|
19
|
-
for (const name of ["adapters.mjs", "errors.mjs"])
|
|
20
|
-
await copyFile(new URL(`../../agent-worker/${name}`, import.meta.url), new URL(name, workerCore));
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
// This candidate rebases coordination on the immutable published 0.1.21 bundle.
|
|
3
|
+
// Its bundled SDK is the release source; do not rebuild it from an older sibling checkout.
|
|
4
|
+
for (const name of [
|
|
5
|
+
"totem.mjs", "mission-worker.mjs", "mission-coordination.mjs",
|
|
6
|
+
"sdk/index.js", "sdk/index.d.ts", "sdk/types.d.ts",
|
|
7
|
+
"network-retry.mjs", "runtime-diagnostics.mjs", "codex-chat-bridge.mjs",
|
|
8
|
+
"worker-core/adapters.mjs", "worker-core/errors.mjs",
|
|
9
|
+
]) await access(new URL(`../bin/${name}`, import.meta.url));
|