@moorline/contracts 0.0.1 → 0.0.2
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/dist/capabilities.d.ts +1 -1
- package/dist/capabilities.js +8 -8
- package/dist/capabilities.js.map +1 -1
- package/dist/distro.d.ts +1 -2
- package/dist/distro.js.map +1 -1
- package/dist/external.d.ts +59 -0
- package/dist/external.js +2 -0
- package/dist/external.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/package.d.ts +1 -0
- package/dist/package.js +40 -1
- package/dist/package.js.map +1 -1
- package/dist/plugin-runtime.d.ts +178 -122
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +2 -1
- package/dist/plugin.js.map +1 -1
- package/dist/provider.d.ts +89 -8
- package/dist/provider.js +200 -0
- package/dist/provider.js.map +1 -1
- package/dist/runtime.d.ts +10 -1
- package/dist/runtime.js +10 -0
- package/dist/runtime.js.map +1 -1
- package/dist/transport.d.ts +44 -35
- package/dist/transport.js.map +1 -1
- package/package.json +1 -1
package/dist/plugin-runtime.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { Capability } from './capabilities.js';
|
|
2
|
+
import type { JsonSchemaLike } from './package.js';
|
|
2
3
|
import type { PluginManifest, RuntimeManagementContribution } from './plugin.js';
|
|
3
4
|
import type { RuntimeProviderTestResult } from './provider.js';
|
|
4
5
|
import type { RuntimeActionDefinition, RuntimeActorIdentity, RuntimeAttachmentPayload, RuntimeMessagePayload, RuntimeSurfaceState, RuntimeTransportEvent } from './transport.js';
|
|
5
|
-
import type { PendingRuntimeRequestRecord, ProviderRuntimeEvent, ProviderSessionStatus, ProviderThreadTokenUsage, RuntimeModeName } from './runtime.js';
|
|
6
|
+
import type { PendingRuntimeRequestRecord, ProviderResumeCursor, ProviderRuntimeEvent, ProviderSessionStatus, ProviderThreadTokenUsage, RuntimeAgentKind, RuntimeModeName } from './runtime.js';
|
|
7
|
+
import type { RuntimeExternalResourceRecord, RuntimeExternalResourceRef, RuntimeGateRunRecord, RuntimeHeadlessRunResult, RuntimeWorkItemRecord, RuntimeWorkItemStatus } from './external.js';
|
|
6
8
|
export interface RuntimeDomainEvent {
|
|
7
9
|
eventId: string;
|
|
8
10
|
threadId: string;
|
|
9
|
-
|
|
11
|
+
transportResourceId?: string | null;
|
|
10
12
|
sessionId?: string | null;
|
|
11
|
-
missionId?: string | null;
|
|
12
13
|
sourceProviderEventId?: string | null;
|
|
13
14
|
createdAt: string;
|
|
14
15
|
type: string;
|
|
@@ -42,10 +43,8 @@ export interface WrittenSkillResult {
|
|
|
42
43
|
export type RuntimeEntityRecord = {
|
|
43
44
|
id?: string;
|
|
44
45
|
sessionId?: string;
|
|
45
|
-
missionId?: string;
|
|
46
|
-
runId?: string;
|
|
47
46
|
threadId?: string;
|
|
48
|
-
|
|
47
|
+
transportResourceId?: string;
|
|
49
48
|
name?: string;
|
|
50
49
|
title?: string;
|
|
51
50
|
status?: string;
|
|
@@ -57,13 +56,16 @@ export type RuntimeSessionRow = RuntimeEntityRecord & {
|
|
|
57
56
|
sessionId: string;
|
|
58
57
|
scopeId: string;
|
|
59
58
|
threadId: string;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
transportResourceId: string;
|
|
60
|
+
transportResourceName: string;
|
|
61
|
+
agentKind?: RuntimeAgentKind;
|
|
62
|
+
workspacePath: string | null;
|
|
63
|
+
providerCwd?: string | null;
|
|
63
64
|
summary: string | null;
|
|
64
65
|
provider: string;
|
|
65
66
|
providerThreadId: string | null;
|
|
66
|
-
|
|
67
|
+
resumeCursor?: ProviderResumeCursor | null;
|
|
68
|
+
toolGrantIds?: string[];
|
|
67
69
|
providerStatus: ProviderSessionStatus;
|
|
68
70
|
activeTurnId: string | null;
|
|
69
71
|
createdAt: string;
|
|
@@ -74,24 +76,10 @@ export type RuntimeSessionRow = RuntimeEntityRecord & {
|
|
|
74
76
|
lifecycleStatus: SessionLifecycleStatus;
|
|
75
77
|
runtimeMode: RuntimeModeName;
|
|
76
78
|
};
|
|
77
|
-
export type RuntimeMissionRow = RuntimeEntityRecord & {
|
|
78
|
-
missionId: string;
|
|
79
|
-
title: string;
|
|
80
|
-
spaceId: string;
|
|
81
|
-
};
|
|
82
|
-
export type RuntimeMissionRunRow = RuntimeEntityRecord & {
|
|
83
|
-
runId: string;
|
|
84
|
-
missionId: string;
|
|
85
|
-
};
|
|
86
|
-
export type RuntimeMissionHookBindingRow = RuntimeEntityRecord & {
|
|
87
|
-
bindingId: string;
|
|
88
|
-
missionId: string;
|
|
89
|
-
hookKey: string;
|
|
90
|
-
};
|
|
91
79
|
export interface RuntimeReceiptRecord {
|
|
92
80
|
threadId: string;
|
|
93
81
|
sessionId: string | null;
|
|
94
|
-
|
|
82
|
+
transportResourceId: string | null;
|
|
95
83
|
state: string;
|
|
96
84
|
updatedAt: string;
|
|
97
85
|
}
|
|
@@ -105,7 +93,9 @@ export interface RuntimeProviderConnectionSnapshot {
|
|
|
105
93
|
threadId: string;
|
|
106
94
|
providerPackageId: string;
|
|
107
95
|
runtimeMode: RuntimeModeName;
|
|
108
|
-
|
|
96
|
+
agentKind?: RuntimeAgentKind;
|
|
97
|
+
workspacePath: string | null;
|
|
98
|
+
providerCwd?: string | null;
|
|
109
99
|
providerThreadId: string | null;
|
|
110
100
|
status: ProviderSessionStatus;
|
|
111
101
|
model: string | null;
|
|
@@ -205,10 +195,10 @@ export interface ManagedSidecarRecord {
|
|
|
205
195
|
scopeKey: string;
|
|
206
196
|
status: string;
|
|
207
197
|
}
|
|
208
|
-
export type AgentSurface = '
|
|
198
|
+
export type AgentSurface = 'coordination' | 'session';
|
|
209
199
|
export interface BeforeAgentPromptInput {
|
|
210
200
|
surface: AgentSurface;
|
|
211
|
-
|
|
201
|
+
transportResourceId: string;
|
|
212
202
|
actorId: string;
|
|
213
203
|
actorLabel: string;
|
|
214
204
|
text: string;
|
|
@@ -218,31 +208,46 @@ export interface BeforeAgentPromptInput {
|
|
|
218
208
|
export interface AfterAgentResponseInput extends BeforeAgentPromptInput {
|
|
219
209
|
replyMessage: string;
|
|
220
210
|
}
|
|
211
|
+
export interface RuntimeAgentContextContribution {
|
|
212
|
+
systemPromptSections?: string[];
|
|
213
|
+
perTurnContext?: Array<{
|
|
214
|
+
title: string;
|
|
215
|
+
content: string;
|
|
216
|
+
source: string;
|
|
217
|
+
}>;
|
|
218
|
+
toolGrantIds?: string[];
|
|
219
|
+
}
|
|
221
220
|
export interface CreatedSessionResult {
|
|
222
221
|
session: RuntimeSessionRow;
|
|
223
|
-
|
|
222
|
+
transportResourceId: string;
|
|
224
223
|
}
|
|
225
|
-
export type
|
|
226
|
-
export interface MissionHookDispatchResult {
|
|
227
|
-
hookKey: string;
|
|
228
|
-
source: string;
|
|
229
|
-
bindingCount: number;
|
|
230
|
-
matchedBindingCount: number;
|
|
231
|
-
triggeredMissionIds: string[];
|
|
232
|
-
}
|
|
233
|
-
export type ArchivedSpaceTarget = {
|
|
224
|
+
export type ArchivedTransportResourceTarget = {
|
|
234
225
|
kind: 'session';
|
|
235
226
|
session: RuntimeSessionRow;
|
|
236
|
-
} | {
|
|
237
|
-
kind: 'mission';
|
|
238
|
-
mission: RuntimeMissionRow;
|
|
239
227
|
};
|
|
240
|
-
export type SessionOwnerKind =
|
|
228
|
+
export type SessionOwnerKind = string;
|
|
241
229
|
export interface SessionOwnerLink {
|
|
242
230
|
kind: SessionOwnerKind;
|
|
243
231
|
id: string;
|
|
244
232
|
label?: string;
|
|
245
233
|
}
|
|
234
|
+
export interface RuntimePackageStateRecord<T = unknown> {
|
|
235
|
+
packageId: string;
|
|
236
|
+
key: string;
|
|
237
|
+
value: T | null;
|
|
238
|
+
updatedAt: string;
|
|
239
|
+
}
|
|
240
|
+
export interface RuntimePackageJobRecord {
|
|
241
|
+
packageId: string;
|
|
242
|
+
jobId: string;
|
|
243
|
+
actionId: string;
|
|
244
|
+
schedule: string;
|
|
245
|
+
scheduleAnchorAt: string;
|
|
246
|
+
nextRunAt: string | null;
|
|
247
|
+
payload: Record<string, unknown>;
|
|
248
|
+
createdAt: string;
|
|
249
|
+
updatedAt: string;
|
|
250
|
+
}
|
|
246
251
|
export interface SessionQueryFilter {
|
|
247
252
|
scope?: SessionInventoryScope;
|
|
248
253
|
lifecycleStatuses?: RuntimeSessionRow['lifecycleStatus'][];
|
|
@@ -275,14 +280,15 @@ export interface RuntimePluginAdminConfig {
|
|
|
275
280
|
};
|
|
276
281
|
}
|
|
277
282
|
export type RuntimePluginConfig = object;
|
|
278
|
-
export type
|
|
283
|
+
export type RuntimePluginSurfaceState = RuntimeSurfaceState;
|
|
279
284
|
export interface RuntimeToolContext {
|
|
280
285
|
readonly actorId: string;
|
|
281
286
|
readonly config: RuntimePluginConfig;
|
|
282
|
-
|
|
287
|
+
getCurrentTransportResourceId(): string;
|
|
283
288
|
getCurrentThreadId(): string;
|
|
284
289
|
getCurrentWorkspacePath(): string;
|
|
285
|
-
|
|
290
|
+
getCoordinationWorkspacePath(): string;
|
|
291
|
+
getRuntimeRootPath(): string;
|
|
286
292
|
listSkills(): SkillCatalogEntry[];
|
|
287
293
|
loadSkill(name: string): Promise<LoadedSkill | null>;
|
|
288
294
|
writeSkill(input: {
|
|
@@ -297,29 +303,100 @@ export interface RuntimeToolContext {
|
|
|
297
303
|
}>;
|
|
298
304
|
}): Promise<WrittenSkillResult>;
|
|
299
305
|
listSessions(): RuntimeSessionRow[];
|
|
300
|
-
|
|
306
|
+
getSessionByTransportResourceId(transportResourceId: string): RuntimeSessionRow | null;
|
|
301
307
|
getSessionById(sessionId: string): RuntimeSessionRow | null;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
308
|
+
getPackageState<T = unknown>(key: string): T | null;
|
|
309
|
+
putPackageState<T = unknown>(key: string, value: T): Promise<void>;
|
|
310
|
+
deletePackageState(key: string): Promise<void>;
|
|
311
|
+
listPackageState<T = unknown>(prefix?: string): RuntimePackageStateRecord<T>[];
|
|
312
|
+
schedulePackageJob(input: {
|
|
313
|
+
jobId: string;
|
|
314
|
+
actionId: string;
|
|
315
|
+
schedule: string;
|
|
316
|
+
startTime?: string;
|
|
317
|
+
payload?: Record<string, unknown>;
|
|
318
|
+
}): Promise<RuntimePackageJobRecord>;
|
|
319
|
+
cancelPackageJob(jobId: string): Promise<RuntimePackageJobRecord | null>;
|
|
320
|
+
listPackageJobs(): RuntimePackageJobRecord[];
|
|
321
|
+
enqueueWorkItem(input: {
|
|
322
|
+
queue: string;
|
|
323
|
+
workItemId?: string;
|
|
324
|
+
idempotencyKey?: string;
|
|
325
|
+
externalResource?: RuntimeExternalResourceRef;
|
|
320
326
|
payload?: Record<string, unknown>;
|
|
321
|
-
|
|
322
|
-
|
|
327
|
+
priority?: number;
|
|
328
|
+
runAfter?: string | null;
|
|
329
|
+
maxAttempts?: number;
|
|
330
|
+
}): Promise<RuntimeWorkItemRecord>;
|
|
331
|
+
claimWorkItem(input: {
|
|
332
|
+
queue: string;
|
|
333
|
+
leaseSeconds?: number;
|
|
334
|
+
leaseOwner?: string;
|
|
335
|
+
}): Promise<RuntimeWorkItemRecord | null>;
|
|
336
|
+
completeWorkItem(input: {
|
|
337
|
+
workItemId: string;
|
|
338
|
+
phase?: string;
|
|
339
|
+
}): Promise<RuntimeWorkItemRecord>;
|
|
340
|
+
failWorkItem(input: {
|
|
341
|
+
workItemId: string;
|
|
342
|
+
error: string;
|
|
343
|
+
retryAfter?: string | null;
|
|
344
|
+
phase?: string;
|
|
345
|
+
}): Promise<RuntimeWorkItemRecord>;
|
|
346
|
+
deadLetterWorkItem(input: {
|
|
347
|
+
workItemId: string;
|
|
348
|
+
reason: string;
|
|
349
|
+
phase?: string;
|
|
350
|
+
}): Promise<RuntimeWorkItemRecord>;
|
|
351
|
+
updateWorkItem(input: {
|
|
352
|
+
workItemId: string;
|
|
353
|
+
payload?: Record<string, unknown>;
|
|
354
|
+
phase?: string;
|
|
355
|
+
externalResource?: RuntimeExternalResourceRef;
|
|
356
|
+
sessionId?: string;
|
|
357
|
+
}): Promise<RuntimeWorkItemRecord>;
|
|
358
|
+
getWorkItem(workItemId: string): RuntimeWorkItemRecord | null;
|
|
359
|
+
listWorkItems(filter?: {
|
|
360
|
+
queue?: string;
|
|
361
|
+
status?: RuntimeWorkItemStatus;
|
|
362
|
+
externalResource?: RuntimeExternalResourceRef;
|
|
363
|
+
limit?: number;
|
|
364
|
+
}): RuntimeWorkItemRecord[];
|
|
365
|
+
upsertExternalResource(input: RuntimeExternalResourceRef & {
|
|
366
|
+
state?: string;
|
|
367
|
+
}): Promise<RuntimeExternalResourceRecord>;
|
|
368
|
+
listExternalResources(filter?: {
|
|
369
|
+
provider?: string;
|
|
370
|
+
kind?: string;
|
|
371
|
+
limit?: number;
|
|
372
|
+
}): RuntimeExternalResourceRecord[];
|
|
373
|
+
bindSessionToExternalResource(input: {
|
|
374
|
+
sessionId: string;
|
|
375
|
+
externalResource: RuntimeExternalResourceRef;
|
|
376
|
+
relationship?: string;
|
|
377
|
+
}): Promise<void>;
|
|
378
|
+
listSessionsForExternalResource(resource: RuntimeExternalResourceRef): RuntimeSessionSnapshot[];
|
|
379
|
+
runGate(input: {
|
|
380
|
+
gateId: string;
|
|
381
|
+
command: string;
|
|
382
|
+
args?: string[];
|
|
383
|
+
cwd?: string;
|
|
384
|
+
required?: boolean;
|
|
385
|
+
workItemId?: string;
|
|
386
|
+
sessionId?: string;
|
|
387
|
+
}): Promise<RuntimeGateRunRecord>;
|
|
388
|
+
runHeadless(input: {
|
|
389
|
+
requestedName: string;
|
|
390
|
+
runtimeMode: RuntimeModeName;
|
|
391
|
+
prompt: string;
|
|
392
|
+
objective?: string;
|
|
393
|
+
owner?: SessionOwnerLink;
|
|
394
|
+
tags?: string[];
|
|
395
|
+
externalResource?: RuntimeExternalResourceRef;
|
|
396
|
+
workItemId?: string;
|
|
397
|
+
outputSchema?: JsonSchemaLike;
|
|
398
|
+
requireStructuredOutput?: boolean;
|
|
399
|
+
}): Promise<RuntimeHeadlessRunResult>;
|
|
323
400
|
querySessions(filter?: SessionQueryFilter): RuntimeSessionSnapshot[];
|
|
324
401
|
createSession(input: {
|
|
325
402
|
requestedName: string;
|
|
@@ -328,10 +405,12 @@ export interface RuntimeToolContext {
|
|
|
328
405
|
objective?: string;
|
|
329
406
|
owner?: SessionOwnerLink;
|
|
330
407
|
tags?: string[];
|
|
408
|
+
externalResource?: RuntimeExternalResourceRef;
|
|
409
|
+
workItemId?: string;
|
|
331
410
|
}): Promise<CreatedSessionResult>;
|
|
332
411
|
directSession(input: {
|
|
333
412
|
sessionId?: string;
|
|
334
|
-
|
|
413
|
+
transportResourceId?: string;
|
|
335
414
|
instruction: string;
|
|
336
415
|
reason?: string;
|
|
337
416
|
}): Promise<{
|
|
@@ -339,41 +418,14 @@ export interface RuntimeToolContext {
|
|
|
339
418
|
reply: RuntimeMessagePayload;
|
|
340
419
|
}>;
|
|
341
420
|
archiveSession(input: {
|
|
342
|
-
|
|
421
|
+
transportResourceId: string;
|
|
343
422
|
sessionId?: string;
|
|
344
423
|
}): Promise<RuntimeSessionRow | null>;
|
|
345
424
|
deleteArchivedSession(input: {
|
|
346
|
-
|
|
425
|
+
transportResourceId: string;
|
|
347
426
|
sessionId?: string;
|
|
348
427
|
}): Promise<RuntimeSessionRow | null>;
|
|
349
|
-
|
|
350
|
-
title: string;
|
|
351
|
-
goal: string;
|
|
352
|
-
schedule: string;
|
|
353
|
-
startTime?: string;
|
|
354
|
-
runtimeMode: RuntimeModeName;
|
|
355
|
-
}): Promise<{
|
|
356
|
-
mission: RuntimeMissionRow;
|
|
357
|
-
spaceId: string;
|
|
358
|
-
}>;
|
|
359
|
-
pauseMission(input: {
|
|
360
|
-
spaceId: string;
|
|
361
|
-
missionId?: string;
|
|
362
|
-
}): Promise<RuntimeMissionRow | null>;
|
|
363
|
-
resumeMission(input: {
|
|
364
|
-
spaceId: string;
|
|
365
|
-
missionId?: string;
|
|
366
|
-
}): Promise<RuntimeMissionRow | null>;
|
|
367
|
-
stopMission(input: {
|
|
368
|
-
spaceId: string;
|
|
369
|
-
missionId?: string;
|
|
370
|
-
}): Promise<RuntimeMissionRow | null>;
|
|
371
|
-
runMissionNow(input: {
|
|
372
|
-
spaceId: string;
|
|
373
|
-
missionId?: string;
|
|
374
|
-
requesterActorId?: string;
|
|
375
|
-
}): Promise<RuntimeMissionRow | null>;
|
|
376
|
-
sendMessage(spaceId: string, payload: RuntimeMessagePayload): Promise<void>;
|
|
428
|
+
sendMessage(transportResourceId: string, payload: RuntimeMessagePayload): Promise<void>;
|
|
377
429
|
sendStatusUpdate(payload: RuntimeMessagePayload): Promise<void>;
|
|
378
430
|
appendAuditEvent(event: string, payload: Record<string, unknown>): void;
|
|
379
431
|
nowIso(): string;
|
|
@@ -381,14 +433,14 @@ export interface RuntimeToolContext {
|
|
|
381
433
|
export interface RuntimePluginAdminCapability {
|
|
382
434
|
getAdminConfig(): RuntimePluginAdminConfig;
|
|
383
435
|
isAdminActor(input: RuntimeActorIdentity): boolean;
|
|
384
|
-
|
|
436
|
+
getSurfaceState(): RuntimePluginSurfaceState;
|
|
385
437
|
}
|
|
386
438
|
export interface RuntimePluginObservabilityCapability {
|
|
387
|
-
listPendingRequests(
|
|
439
|
+
listPendingRequests(transportResourceId: string): PendingRuntimeRequestRecord[];
|
|
388
440
|
listRuntimeReceipts(): RuntimeReceiptRecord[];
|
|
389
441
|
listProviderConnections(): RuntimeProviderConnectionSnapshot[];
|
|
390
442
|
listRuntimeActivities(threadId?: string): RuntimeActivityRecord[];
|
|
391
|
-
|
|
443
|
+
getSessionSnapshotByTransportResourceId(transportResourceId: string): RuntimeSessionSnapshot | null;
|
|
392
444
|
getSessionSnapshotById(sessionId: string): RuntimeSessionSnapshot | null;
|
|
393
445
|
getRuntimeOverview(): RuntimeOverviewSnapshot;
|
|
394
446
|
listProjectionStates(): Array<{
|
|
@@ -416,20 +468,20 @@ export interface RuntimePluginObservabilityCapability {
|
|
|
416
468
|
};
|
|
417
469
|
listRuntimeEvents(threadId: string): ProviderRuntimeEvent[];
|
|
418
470
|
listDomainEvents(threadId: string): RuntimeDomainEvent[];
|
|
419
|
-
updateSessionSummary(
|
|
471
|
+
updateSessionSummary(transportResourceId: string, summary: string, nowIso: string): Promise<void>;
|
|
420
472
|
}
|
|
421
473
|
export interface RuntimePluginMemoryCapability {
|
|
422
474
|
retrieveMemory(input: {
|
|
423
475
|
query: string;
|
|
424
476
|
scopeId: string;
|
|
425
|
-
|
|
477
|
+
transportResourceId?: string;
|
|
426
478
|
threadId?: string | null;
|
|
427
479
|
maxResults?: number;
|
|
428
480
|
enableRerank?: boolean;
|
|
429
481
|
}): Promise<RetrievedMemorySnippet[]>;
|
|
430
482
|
writeSessionMemory(input: {
|
|
431
483
|
scopeId: string;
|
|
432
|
-
|
|
484
|
+
transportResourceId: string;
|
|
433
485
|
threadId?: string | null;
|
|
434
486
|
kind: 'log' | 'summary' | 'facts' | 'tasks';
|
|
435
487
|
content: string;
|
|
@@ -449,20 +501,12 @@ export interface RuntimePluginMemoryCapability {
|
|
|
449
501
|
}): Promise<void>;
|
|
450
502
|
}
|
|
451
503
|
export interface RuntimePluginWorkManagementCapability {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
missionId?: string;
|
|
459
|
-
}): Promise<RuntimeMissionRow | null>;
|
|
460
|
-
archiveSpaceTarget(input: {
|
|
461
|
-
spaceId: string;
|
|
462
|
-
}): Promise<ArchivedSpaceTarget | null>;
|
|
463
|
-
deleteArchivedSpaceTarget(input: {
|
|
464
|
-
spaceId: string;
|
|
465
|
-
}): Promise<ArchivedSpaceTarget | null>;
|
|
504
|
+
archiveTransportResourceTarget(input: {
|
|
505
|
+
transportResourceId: string;
|
|
506
|
+
}): Promise<ArchivedTransportResourceTarget | null>;
|
|
507
|
+
deleteArchivedTransportResourceTarget(input: {
|
|
508
|
+
transportResourceId: string;
|
|
509
|
+
}): Promise<ArchivedTransportResourceTarget | null>;
|
|
466
510
|
respondToRuntimeRequest(input: {
|
|
467
511
|
threadId: string;
|
|
468
512
|
requestId: string;
|
|
@@ -531,15 +575,24 @@ export interface RuntimePluginSidecarCapability {
|
|
|
531
575
|
export interface RuntimePluginAgentCapability {
|
|
532
576
|
runAgent(input: {
|
|
533
577
|
surface: AgentSurface;
|
|
534
|
-
|
|
578
|
+
transportResourceId: string;
|
|
535
579
|
actorId: string;
|
|
536
580
|
actorLabel: string;
|
|
537
|
-
|
|
581
|
+
message: string;
|
|
538
582
|
attachments?: RuntimeAttachmentPayload[];
|
|
539
583
|
session: RuntimeSessionRow | null;
|
|
540
|
-
cwd
|
|
584
|
+
cwd?: string | null;
|
|
541
585
|
runtimeMode: RuntimeModeName;
|
|
542
|
-
|
|
586
|
+
agentKind?: RuntimeAgentKind;
|
|
587
|
+
toolGrantIds?: string[];
|
|
588
|
+
context?: {
|
|
589
|
+
systemPromptSections?: string[];
|
|
590
|
+
perTurnContext?: Array<{
|
|
591
|
+
title: string;
|
|
592
|
+
content: string;
|
|
593
|
+
source: string;
|
|
594
|
+
}>;
|
|
595
|
+
};
|
|
543
596
|
promptSource?: string;
|
|
544
597
|
}): Promise<RuntimeMessagePayload>;
|
|
545
598
|
drainRuntimeWork(): Promise<void>;
|
|
@@ -561,11 +614,14 @@ export interface RuntimePlugin {
|
|
|
561
614
|
tools?(context: RuntimeToolContext): RuntimeToolDefinition[];
|
|
562
615
|
onRuntimeStarted?(context: RuntimePluginContext): Promise<void> | void;
|
|
563
616
|
onTransportEvent?(event: RuntimeTransportEvent, context: RuntimePluginContext): Promise<RuntimeActionDispatchResult | boolean | void> | RuntimeActionDispatchResult | boolean | void;
|
|
617
|
+
onExternalEvent?(event: Extract<RuntimeTransportEvent, {
|
|
618
|
+
type: 'external.event.received';
|
|
619
|
+
}>, context: RuntimePluginContext): Promise<RuntimeActionDispatchResult | boolean | void> | RuntimeActionDispatchResult | boolean | void;
|
|
564
620
|
onAction?(event: Extract<RuntimeTransportEvent, {
|
|
565
621
|
type: 'action.invoked';
|
|
566
622
|
}>, context: RuntimePluginContext): Promise<RuntimeActionDispatchResult | boolean | void> | RuntimeActionDispatchResult | boolean | void;
|
|
567
623
|
onRuntimeEvent?(event: ProviderRuntimeEvent, context: RuntimePluginContext): Promise<void> | void;
|
|
568
|
-
|
|
624
|
+
contributeAgentContext?(input: BeforeAgentPromptInput, context: RuntimePluginContext): Promise<RuntimeAgentContextContribution> | RuntimeAgentContextContribution;
|
|
569
625
|
afterAgentResponse?(input: AfterAgentResponseInput, context: RuntimePluginContext): Promise<void> | void;
|
|
570
626
|
onDomainEvent?(event: RuntimeDomainEvent, context: RuntimePluginContext): Promise<void> | void;
|
|
571
627
|
onRuntimeReceipt?(receipt: RuntimeReceiptRecord, context: RuntimePluginContext): Promise<void> | void;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -26,5 +26,5 @@ export interface RuntimeManagementContribution {
|
|
|
26
26
|
}
|
|
27
27
|
export type { RuntimeActionDefinition };
|
|
28
28
|
export * from './plugin-runtime.js';
|
|
29
|
-
export declare const KNOWN_PLUGIN_HOOKS: readonly ["onRuntimeStarted", "onTransportEvent", "onAction", "onRuntimeEvent", "
|
|
29
|
+
export declare const KNOWN_PLUGIN_HOOKS: readonly ["onRuntimeStarted", "onTransportEvent", "onExternalEvent", "onAction", "onRuntimeEvent", "contributeAgentContext", "afterAgentResponse", "onDomainEvent", "onRuntimeReceipt", "onRuntimeActivity"];
|
|
30
30
|
export declare function validatePluginManifest(manifest: PluginManifest): PluginManifest;
|
package/dist/plugin.js
CHANGED
|
@@ -4,9 +4,10 @@ export * from './plugin-runtime.js';
|
|
|
4
4
|
export const KNOWN_PLUGIN_HOOKS = [
|
|
5
5
|
'onRuntimeStarted',
|
|
6
6
|
'onTransportEvent',
|
|
7
|
+
'onExternalEvent',
|
|
7
8
|
'onAction',
|
|
8
9
|
'onRuntimeEvent',
|
|
9
|
-
'
|
|
10
|
+
'contributeAgentContext',
|
|
10
11
|
'afterAgentResponse',
|
|
11
12
|
'onDomainEvent',
|
|
12
13
|
'onRuntimeReceipt',
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrI,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAmB,MAAM,mBAAmB,CAAC;AA8BzF,cAAc,qBAAqB,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,kBAAkB;IAClB,kBAAkB;IAClB,UAAU;IACV,gBAAgB;IAChB,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrI,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAmB,MAAM,mBAAmB,CAAC;AA8BzF,cAAc,qBAAqB,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,UAAU;IACV,gBAAgB;IAChB,wBAAwB;IACxB,oBAAoB;IACpB,eAAe;IACf,kBAAkB;IAClB,mBAAmB;CACX,CAAC;AAEX,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS,kBAAkB,CAAC,CAAC;AAClE,MAAM,UAAU,sBAAsB,CAAC,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AAC;YAC5D,MAAM,IAAI,KAAK,CAAC,4BAA4B,UAAU,2BAA2B,MAAM,CAAC,EAAY,EAAE,CAAC,CAAC;QAC1G,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,KAAK,MAAM,IAAI,IAAK,MAAM,CAAC,KAA+B,IAAI,EAAE,EAAE,CAAC;QACjE,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IACD,OAAO;QACL,GAAG,QAAQ;QACX,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC"}
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { JsonSchemaLike, PackageDependency, PackageManifestBase } from './package.js';
|
|
2
2
|
import type { EventEmitter } from 'node:events';
|
|
3
|
-
import type { ProviderPackageId, ProviderInputImage, ProviderRuntimeEvent, ProviderSessionRecord, RuntimeCommandRunner, RuntimeModeName } from './runtime.js';
|
|
3
|
+
import type { ProviderPackageId, ProviderInputImage, ProviderResumeCursor, ProviderRuntimeEvent, ProviderSessionRecord, RuntimeCommandRunner, RuntimeAgentKind, RuntimeModeName } from './runtime.js';
|
|
4
|
+
import type { Capability } from './capabilities.js';
|
|
5
|
+
import type { RuntimeToolResult } from './plugin-runtime.js';
|
|
4
6
|
export interface ProviderPackageManifest extends PackageManifestBase {
|
|
5
7
|
type: 'provider';
|
|
6
8
|
entrypoint?: string;
|
|
7
9
|
dependencies?: PackageDependency[];
|
|
8
10
|
configSchema?: JsonSchemaLike;
|
|
9
11
|
displayCategory?: string;
|
|
12
|
+
toolPolicy?: ProviderToolPolicyConfig;
|
|
13
|
+
nativeToolDocumentation?: ProviderNativeToolDocumentation;
|
|
10
14
|
}
|
|
11
15
|
export interface RuntimeProviderPackageContext {
|
|
12
16
|
config: Record<string, unknown>;
|
|
@@ -31,12 +35,84 @@ export interface RuntimeProviderTestResult {
|
|
|
31
35
|
export interface RuntimeProviderSessionInput {
|
|
32
36
|
sessionId: string;
|
|
33
37
|
threadId: string;
|
|
34
|
-
|
|
38
|
+
transportResourceId: string;
|
|
35
39
|
runtimeMode: RuntimeModeName;
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
agentKind: RuntimeAgentKind;
|
|
41
|
+
workspacePath: string | null;
|
|
42
|
+
providerCwd: string | null;
|
|
43
|
+
resumeCursor: ProviderResumeCursor | null;
|
|
38
44
|
lifecycleStatus: string;
|
|
39
45
|
providerAutoStartEnabled?: boolean;
|
|
46
|
+
toolGrantIds: string[];
|
|
47
|
+
toolPolicy: ProviderToolPolicyConfig;
|
|
48
|
+
}
|
|
49
|
+
export interface ProviderToolPolicyProfileConfig {
|
|
50
|
+
nativePreset: string;
|
|
51
|
+
allowNativeTools?: string[];
|
|
52
|
+
denyNativeTools?: string[];
|
|
53
|
+
grants?: string[];
|
|
54
|
+
}
|
|
55
|
+
export interface ProviderToolPolicyConfig {
|
|
56
|
+
workspace: ProviderToolPolicyProfileConfig;
|
|
57
|
+
ephemeral: ProviderToolPolicyProfileConfig;
|
|
58
|
+
}
|
|
59
|
+
export interface ProviderNativeToolDocumentation {
|
|
60
|
+
nativeToolNames: string[];
|
|
61
|
+
defaultWorkspacePreset: string;
|
|
62
|
+
defaultEphemeralPreset: string;
|
|
63
|
+
grantMapping: string;
|
|
64
|
+
}
|
|
65
|
+
export declare const DEFAULT_PROVIDER_TOOL_POLICY: ProviderToolPolicyConfig;
|
|
66
|
+
export interface ProviderSkillResource {
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
filePath: string;
|
|
70
|
+
baseDir: string;
|
|
71
|
+
content?: string;
|
|
72
|
+
metadata: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
export interface ProviderPromptTemplateResource {
|
|
75
|
+
name: string;
|
|
76
|
+
description?: string;
|
|
77
|
+
content: string;
|
|
78
|
+
source: string;
|
|
79
|
+
}
|
|
80
|
+
export interface ProviderResourceBundle {
|
|
81
|
+
systemPromptSections: string[];
|
|
82
|
+
contextFiles: Array<{
|
|
83
|
+
path: string;
|
|
84
|
+
content: string;
|
|
85
|
+
source: string;
|
|
86
|
+
}>;
|
|
87
|
+
skills: ProviderSkillResource[];
|
|
88
|
+
promptTemplates: ProviderPromptTemplateResource[];
|
|
89
|
+
}
|
|
90
|
+
export interface ProviderToolDefinition {
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
inputSchema: Record<string, unknown>;
|
|
95
|
+
requiredCapability?: Capability;
|
|
96
|
+
source: 'core' | 'plugin';
|
|
97
|
+
ownerPackageId?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface ProviderToolExecutor {
|
|
100
|
+
executeProviderTool(input: {
|
|
101
|
+
threadId: string;
|
|
102
|
+
toolId: string;
|
|
103
|
+
arguments: Record<string, unknown>;
|
|
104
|
+
actor: string;
|
|
105
|
+
}): Promise<RuntimeToolResult>;
|
|
106
|
+
}
|
|
107
|
+
export interface ProviderTurnContextItem {
|
|
108
|
+
title: string;
|
|
109
|
+
content: string;
|
|
110
|
+
source: string;
|
|
111
|
+
}
|
|
112
|
+
export interface ProviderTurnInput {
|
|
113
|
+
text: string;
|
|
114
|
+
images?: ProviderInputImage[];
|
|
115
|
+
context?: ProviderTurnContextItem[];
|
|
40
116
|
}
|
|
41
117
|
export interface RuntimeProvider extends EventEmitter<{
|
|
42
118
|
providerEvent: [event: ProviderRuntimeEvent];
|
|
@@ -48,6 +124,9 @@ export interface RuntimeProvider extends EventEmitter<{
|
|
|
48
124
|
runtimeRoot: string;
|
|
49
125
|
actor: string;
|
|
50
126
|
model?: string;
|
|
127
|
+
resources?: ProviderResourceBundle;
|
|
128
|
+
tools?: ProviderToolDefinition[];
|
|
129
|
+
toolExecutor?: ProviderToolExecutor;
|
|
51
130
|
}): Promise<ProviderSessionRecord>;
|
|
52
131
|
recoverSessions(input: {
|
|
53
132
|
sessions: RuntimeProviderSessionInput[];
|
|
@@ -61,10 +140,7 @@ export interface RuntimeProvider extends EventEmitter<{
|
|
|
61
140
|
sendTurn?: boolean;
|
|
62
141
|
prompt?: string;
|
|
63
142
|
}): Promise<RuntimeProviderTestResult>;
|
|
64
|
-
sendTurn(threadId: string, input: {
|
|
65
|
-
text: string;
|
|
66
|
-
images?: ProviderInputImage[];
|
|
67
|
-
}, model?: string): Promise<{
|
|
143
|
+
sendTurn(threadId: string, input: ProviderTurnInput, model?: string): Promise<{
|
|
68
144
|
turnId: string;
|
|
69
145
|
}>;
|
|
70
146
|
compactThread(threadId: string): Promise<void>;
|
|
@@ -86,4 +162,9 @@ export interface RuntimeProviderPackage {
|
|
|
86
162
|
createEnvironmentVerifier?(input: RuntimeProviderPackageContext): RuntimeEnvironmentVerifier | null;
|
|
87
163
|
}
|
|
88
164
|
export declare function validateProviderPackageManifest(manifest: ProviderPackageManifest): ProviderPackageManifest;
|
|
165
|
+
export declare function validateProviderToolPolicyConfig(value: unknown, label?: string): ProviderToolPolicyConfig | undefined;
|
|
166
|
+
export declare function validateProviderResumeCursor(value: unknown, label?: string): ProviderResumeCursor | null;
|
|
167
|
+
export declare function validateRuntimeProviderSessionInput(value: unknown, label?: string): RuntimeProviderSessionInput;
|
|
168
|
+
export declare function validateProviderResourceBundle(value: unknown, label?: string): ProviderResourceBundle;
|
|
169
|
+
export declare function validateProviderToolDefinition(value: unknown, label?: string): ProviderToolDefinition;
|
|
89
170
|
export declare function validateProviderPackageRuntimeContract(pkg: RuntimeProviderPackage): void;
|