glove-foundry 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-L5JQVTHD.js → chunk-N2GVJ257.js} +12 -0
- package/dist/{chunk-LI7VIGVH.js → chunk-PMNRLJIQ.js} +327 -143
- package/dist/{chunk-EUGKVW3J.js → chunk-T6YLIGER.js} +135 -12
- package/dist/cli.js +2 -2
- package/dist/{client-CCY4_vqN.d.ts → client-Cj2wDXuc.d.ts} +40 -4
- package/dist/client.d.ts +2 -2
- package/dist/client.js +1 -1
- package/dist/{event-delivery-CNCsVqi8.d.ts → event-delivery-a9B1Qq_u.d.ts} +141 -50
- package/dist/execution-daemon.js +0 -7
- package/dist/execution-loader.js +4 -2
- package/dist/index.d.ts +9 -5
- package/dist/index.js +42 -3
- package/dist/voice.d.ts +1 -1
- package/docs/architecture.md +18 -0
- package/docs/building-with-foundry.md +1 -1
- package/package.json +5 -5
|
@@ -61,6 +61,77 @@ var EMPTY_FOUNDRY_APPLICATION = defineApplication({
|
|
|
61
61
|
name: "Glove Foundry"
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
+
// src/schedule-occurrences.ts
|
|
65
|
+
import { createHash } from "node:crypto";
|
|
66
|
+
import { nextCronOccurrence } from "station-schedules";
|
|
67
|
+
var TERMINAL_OCCURRENCE_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "skipped", "cancelled"]);
|
|
68
|
+
var SCHEDULE_MISFIRE_GRACE_MS = 6e4;
|
|
69
|
+
var RETAINED_TERMINAL_OCCURRENCES = 100;
|
|
70
|
+
function activationScheduleRevision(activation) {
|
|
71
|
+
return createHash("sha256").update(JSON.stringify({
|
|
72
|
+
definitionId: activation.definitionId,
|
|
73
|
+
agentId: activation.agentId,
|
|
74
|
+
conversationId: activation.conversationId,
|
|
75
|
+
message: activation.message,
|
|
76
|
+
payload: activation.payload ?? null,
|
|
77
|
+
timing: activation.timing
|
|
78
|
+
})).digest("hex");
|
|
79
|
+
}
|
|
80
|
+
function scheduleOccurrenceId(activationId, revision, scheduledFor) {
|
|
81
|
+
const instant = new Date(scheduledFor).toISOString();
|
|
82
|
+
return `occurrence_${createHash("sha256").update(JSON.stringify([activationId, revision, instant])).digest("hex")}`;
|
|
83
|
+
}
|
|
84
|
+
function scheduleMisfirePolicy(timing) {
|
|
85
|
+
return timing.kind === "at" ? "fire-once" : timing.misfire ?? "fire-once";
|
|
86
|
+
}
|
|
87
|
+
function nextScheduledTime(timing, after) {
|
|
88
|
+
if (timing.kind === "every") return new Date(after.getTime() + timing.intervalMs);
|
|
89
|
+
if (timing.kind === "cron") return nextCronOccurrence(timing.expression, timing.timezone, after);
|
|
90
|
+
const at = new Date(timing.at);
|
|
91
|
+
return at.getTime() > after.getTime() ? at : void 0;
|
|
92
|
+
}
|
|
93
|
+
function firstScheduledTime(timing, now) {
|
|
94
|
+
if (timing.kind === "at") return new Date(timing.at);
|
|
95
|
+
return nextScheduledTime(timing, now);
|
|
96
|
+
}
|
|
97
|
+
function planScheduleOccurrence(timing, scheduledFor, now) {
|
|
98
|
+
const policy = scheduleMisfirePolicy(timing);
|
|
99
|
+
let next = nextScheduledTime(timing, scheduledFor);
|
|
100
|
+
if (policy === "catch-up" || !next) {
|
|
101
|
+
return { deliver: true, ...next ? { next } : {}, coalesced: 0 };
|
|
102
|
+
}
|
|
103
|
+
let coalesced = 0;
|
|
104
|
+
while (next.getTime() <= now.getTime()) {
|
|
105
|
+
coalesced++;
|
|
106
|
+
next = nextScheduledTime(timing, next);
|
|
107
|
+
}
|
|
108
|
+
const late = now.getTime() - scheduledFor.getTime() > SCHEDULE_MISFIRE_GRACE_MS;
|
|
109
|
+
if (policy === "skip" && late) return { deliver: false, next, coalesced: 0 };
|
|
110
|
+
return { deliver: true, next, coalesced };
|
|
111
|
+
}
|
|
112
|
+
function matchesOccurrenceFilter(occurrence, filter = {}) {
|
|
113
|
+
if (filter.activationId && occurrence.activationId !== filter.activationId) return false;
|
|
114
|
+
if (filter.workspaceId && occurrence.workspaceId !== filter.workspaceId) return false;
|
|
115
|
+
if (filter.agentId && occurrence.agentId !== filter.agentId) return false;
|
|
116
|
+
if (filter.status) {
|
|
117
|
+
const statuses = typeof filter.status === "string" ? [filter.status] : filter.status;
|
|
118
|
+
if (!statuses.includes(occurrence.status)) return false;
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
function compareOccurrences(left, right) {
|
|
123
|
+
return left.scheduledFor.localeCompare(right.scheduledFor) || left.id.localeCompare(right.id);
|
|
124
|
+
}
|
|
125
|
+
function prunableOccurrences(occurrences, activationId, keep = RETAINED_TERMINAL_OCCURRENCES) {
|
|
126
|
+
const terminal = [...occurrences].filter((item) => item.activationId === activationId && TERMINAL_OCCURRENCE_STATUSES.has(item.status)).sort(compareOccurrences);
|
|
127
|
+
return terminal.slice(0, Math.max(0, terminal.length - keep)).map((item) => item.id);
|
|
128
|
+
}
|
|
129
|
+
function assertScheduleOccurrence(occurrence) {
|
|
130
|
+
if (!occurrence.id.startsWith("occurrence_")) throw new Error("Schedule occurrence id is invalid.");
|
|
131
|
+
if (!occurrence.activationId || !occurrence.revision) throw new Error("Schedule occurrence must name its activation and revision.");
|
|
132
|
+
if (Number.isNaN(Date.parse(occurrence.scheduledFor))) throw new Error("Schedule occurrence has an invalid scheduled time.");
|
|
133
|
+
}
|
|
134
|
+
|
|
64
135
|
// src/composition.ts
|
|
65
136
|
var composedToolBodies = /* @__PURE__ */ new WeakMap();
|
|
66
137
|
function isToolBody(value) {
|
|
@@ -364,7 +435,7 @@ function defineTransmission(options) {
|
|
|
364
435
|
}
|
|
365
436
|
|
|
366
437
|
// src/playbook.ts
|
|
367
|
-
import { createHash } from "node:crypto";
|
|
438
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
368
439
|
var ID2 = /^[a-z][a-z0-9-]*(?:\/[a-z][a-z0-9-]*)*$/;
|
|
369
440
|
function assertData(value, path, seen = /* @__PURE__ */ new Set()) {
|
|
370
441
|
if (value === void 0) throw new Error(`Playbook ${path} cannot contain undefined.`);
|
|
@@ -508,12 +579,12 @@ function reconstructPlaybook(playbook) {
|
|
|
508
579
|
var FOUNDRY_PLAYBOOK_ACTION_BRAND = /* @__PURE__ */ Symbol.for("glove-foundry-playbook-action");
|
|
509
580
|
var FOUNDRY_COMPOSED_PLAYBOOK_BRAND = /* @__PURE__ */ Symbol.for("glove-foundry-composed-playbook");
|
|
510
581
|
function agentPlaybookId(definitionId, agentId, name) {
|
|
511
|
-
return `playbook-${
|
|
582
|
+
return `playbook-${createHash2("sha256").update(`${definitionId}\0${agentId}\0${name}`).digest("hex").slice(0, 24)}`;
|
|
512
583
|
}
|
|
513
584
|
function composedPlaybookRevision(playbook) {
|
|
514
585
|
const materialized = materializeComposedPlaybook(playbook, "playbook-revision", "pending");
|
|
515
586
|
const { id: _id, definitionRevision: _revision, ...data } = materialized;
|
|
516
|
-
return
|
|
587
|
+
return createHash2("sha256").update(JSON.stringify(data)).digest("hex");
|
|
517
588
|
}
|
|
518
589
|
function definePlaybookAction(options = {}) {
|
|
519
590
|
if (options.id && !ID2.test(options.id)) {
|
|
@@ -841,6 +912,7 @@ var MemoryFoundryDataAdapter = class {
|
|
|
841
912
|
pendingInbound = /* @__PURE__ */ new Map();
|
|
842
913
|
approvals = /* @__PURE__ */ new Map();
|
|
843
914
|
activations = /* @__PURE__ */ new Map();
|
|
915
|
+
occurrences = /* @__PURE__ */ new Map();
|
|
844
916
|
conversations = /* @__PURE__ */ new Map();
|
|
845
917
|
workspace = /* @__PURE__ */ new Map();
|
|
846
918
|
workingEnvironments = /* @__PURE__ */ new Map();
|
|
@@ -925,6 +997,7 @@ var MemoryFoundryDataAdapter = class {
|
|
|
925
997
|
for (const [id2, item] of this.pendingInbound) if (item.request.agentId === agentId) this.pendingInbound.delete(id2);
|
|
926
998
|
for (const [id2, item] of this.approvals) if (item.agentId === agentId) this.approvals.delete(id2);
|
|
927
999
|
for (const [id2, item] of this.activations) if (item.agentId === agentId) this.activations.delete(id2);
|
|
1000
|
+
for (const [id2, item] of this.occurrences) if (item.agentId === agentId) this.occurrences.delete(id2);
|
|
928
1001
|
for (const id2 of conversationIds) this.conversations.delete(id2);
|
|
929
1002
|
for (const [id2, item] of this.inbox) if (item.agentId === agentId || conversationIds.has(item.conversationId ?? "")) this.inbox.delete(id2);
|
|
930
1003
|
for (const [id2, item] of this.tasks) if (item.agentId === agentId || conversationIds.has(item.conversationId ?? "")) this.tasks.delete(id2);
|
|
@@ -1010,6 +1083,30 @@ var MemoryFoundryDataAdapter = class {
|
|
|
1010
1083
|
listEvents() {
|
|
1011
1084
|
return Effect2.sync(() => [...this.events.values()].map((record) => structuredClone(record)));
|
|
1012
1085
|
}
|
|
1086
|
+
claimScheduleOccurrence(occurrence) {
|
|
1087
|
+
return Effect2.sync(() => {
|
|
1088
|
+
assertScheduleOccurrence(occurrence);
|
|
1089
|
+
if (this.occurrences.has(occurrence.id)) return false;
|
|
1090
|
+
this.occurrences.set(occurrence.id, structuredClone(occurrence));
|
|
1091
|
+
return true;
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
putScheduleOccurrence(occurrence) {
|
|
1095
|
+
return Effect2.sync(() => {
|
|
1096
|
+
assertScheduleOccurrence(occurrence);
|
|
1097
|
+
this.occurrences.set(occurrence.id, structuredClone(occurrence));
|
|
1098
|
+
for (const id2 of prunableOccurrences(this.occurrences.values(), occurrence.activationId)) this.occurrences.delete(id2);
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
getScheduleOccurrence(id2) {
|
|
1102
|
+
return Effect2.sync(() => {
|
|
1103
|
+
const occurrence = this.occurrences.get(id2);
|
|
1104
|
+
return occurrence ? structuredClone(occurrence) : null;
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
listScheduleOccurrences(filter) {
|
|
1108
|
+
return Effect2.sync(() => [...this.occurrences.values()].filter((item) => matchesOccurrenceFilter(item, filter)).sort(compareOccurrences).map((item) => structuredClone(item)));
|
|
1109
|
+
}
|
|
1013
1110
|
putPendingInbound(record) {
|
|
1014
1111
|
return Effect2.sync(() => {
|
|
1015
1112
|
this.pendingInbound.set(record.id, structuredClone(record));
|
|
@@ -1218,8 +1315,9 @@ function id(prefix) {
|
|
|
1218
1315
|
}
|
|
1219
1316
|
|
|
1220
1317
|
// src/schedule.ts
|
|
1221
|
-
import { createHash as
|
|
1318
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
1222
1319
|
import { Duration } from "effect";
|
|
1320
|
+
import { validateCron } from "station-schedules";
|
|
1223
1321
|
var FOUNDRY_SCHEDULE_BRAND = /* @__PURE__ */ Symbol.for("glove-foundry-schedule");
|
|
1224
1322
|
var COMPACT_DURATION = /^(\d+)\s*(ms|s|m|h|d|w)$/i;
|
|
1225
1323
|
function durationMillis(value) {
|
|
@@ -1231,16 +1329,31 @@ function durationMillis(value) {
|
|
|
1231
1329
|
}
|
|
1232
1330
|
return milliseconds;
|
|
1233
1331
|
}
|
|
1332
|
+
function misfirePolicy(value) {
|
|
1333
|
+
if (value === "fire-once" || value === "skip" || value === "catch-up") return value;
|
|
1334
|
+
throw new Error(`Unknown misfire policy "${value}".`);
|
|
1335
|
+
}
|
|
1234
1336
|
function normalizeScheduleTiming(timing, now = Date.now()) {
|
|
1235
1337
|
if (timing.kind === "after") {
|
|
1236
1338
|
return Object.freeze({ kind: "at", at: new Date(now + durationMillis(timing.duration)).toISOString() });
|
|
1237
1339
|
}
|
|
1238
1340
|
if (timing.kind === "every") {
|
|
1239
|
-
return Object.freeze({
|
|
1341
|
+
return Object.freeze({
|
|
1342
|
+
kind: "every",
|
|
1343
|
+
intervalMs: durationMillis(timing.interval),
|
|
1344
|
+
...timing.misfire ? { misfire: misfirePolicy(timing.misfire) } : {}
|
|
1345
|
+
});
|
|
1240
1346
|
}
|
|
1241
1347
|
if (timing.kind === "cron") {
|
|
1242
1348
|
if (!timing.expression.trim()) throw new Error("A cron expression is required.");
|
|
1243
|
-
|
|
1349
|
+
const timezone = timing.timezone ?? "UTC";
|
|
1350
|
+
validateCron(timing.expression, timezone);
|
|
1351
|
+
return Object.freeze({
|
|
1352
|
+
kind: "cron",
|
|
1353
|
+
expression: timing.expression,
|
|
1354
|
+
timezone,
|
|
1355
|
+
...timing.misfire ? { misfire: misfirePolicy(timing.misfire) } : {}
|
|
1356
|
+
});
|
|
1244
1357
|
}
|
|
1245
1358
|
const at = new Date(timing.at);
|
|
1246
1359
|
if (Number.isNaN(at.getTime())) throw new Error(`Invalid schedule date "${timing.at}".`);
|
|
@@ -1262,11 +1375,11 @@ function isFoundrySchedule(value) {
|
|
|
1262
1375
|
return Boolean(value && typeof value === "object" && value[FOUNDRY_SCHEDULE_BRAND] === true);
|
|
1263
1376
|
}
|
|
1264
1377
|
function agentScheduleActivationId(definitionId, agentId, name) {
|
|
1265
|
-
const digest =
|
|
1378
|
+
const digest = createHash3("sha256").update(`${definitionId}\0${agentId}\0${name}`).digest("hex").slice(0, 24);
|
|
1266
1379
|
return `activation_${digest}`;
|
|
1267
1380
|
}
|
|
1268
1381
|
function agentScheduleRevision(schedule) {
|
|
1269
|
-
return
|
|
1382
|
+
return createHash3("sha256").update(JSON.stringify({
|
|
1270
1383
|
message: schedule.message,
|
|
1271
1384
|
payload: schedule.payload,
|
|
1272
1385
|
timing: schedule.timing,
|
|
@@ -1298,11 +1411,12 @@ function durationSchema(description) {
|
|
|
1298
1411
|
function afterDuration(value) {
|
|
1299
1412
|
return normalizeScheduleTiming({ kind: "after", duration: value }).at;
|
|
1300
1413
|
}
|
|
1414
|
+
var misfireSchema = z.enum(["fire-once", "skip", "catch-up"]).optional().describe("Occurrences missed while the runtime was down: fire-once (default) delivers one, catch-up delivers each, skip drops any more than a minute late");
|
|
1301
1415
|
var timingInputSchema = z.discriminatedUnion("kind", [
|
|
1302
1416
|
z.object({ kind: z.literal("at"), at: z.string().datetime() }),
|
|
1303
1417
|
z.object({ kind: z.literal("after"), duration: durationSchema("Delay before the one-time activation") }),
|
|
1304
|
-
z.object({ kind: z.literal("every"), interval: durationSchema("Interval between recurring activations") }),
|
|
1305
|
-
z.object({ kind: z.literal("cron"), expression: z.string().min(1), timezone: z.string().min(1).default("UTC") })
|
|
1418
|
+
z.object({ kind: z.literal("every"), interval: durationSchema("Interval between recurring activations"), misfire: misfireSchema }),
|
|
1419
|
+
z.object({ kind: z.literal("cron"), expression: z.string().min(1), timezone: z.string().min(1).default("UTC"), misfire: misfireSchema })
|
|
1306
1420
|
]);
|
|
1307
1421
|
function toolSegment(value) {
|
|
1308
1422
|
return value.replaceAll("/", "__").replaceAll("-", "_");
|
|
@@ -2254,7 +2368,7 @@ function withFoundryPermissions(store) {
|
|
|
2254
2368
|
}
|
|
2255
2369
|
|
|
2256
2370
|
// src/request-trace.ts
|
|
2257
|
-
import { createHash as
|
|
2371
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
2258
2372
|
var FOUNDRY_MODEL_REQUESTS_ENV = "GLOVE_FOUNDRY_MODEL_REQUESTS";
|
|
2259
2373
|
var TEXT_LIMIT = 16e3;
|
|
2260
2374
|
var JSON_LIMIT = 16e3;
|
|
@@ -2262,7 +2376,7 @@ var SYSTEM_PROMPT_LIMIT = 64e3;
|
|
|
2262
2376
|
var TOOL_SCHEMA_LIMIT = 8e3;
|
|
2263
2377
|
var MESSAGES_BUDGET = 4e5;
|
|
2264
2378
|
function hash(value) {
|
|
2265
|
-
return
|
|
2379
|
+
return createHash4("sha256").update(value).digest("base64url").slice(0, 16);
|
|
2266
2380
|
}
|
|
2267
2381
|
function json(value) {
|
|
2268
2382
|
try {
|
|
@@ -2417,6 +2531,15 @@ export {
|
|
|
2417
2531
|
isFoundryApplication,
|
|
2418
2532
|
defineApplication,
|
|
2419
2533
|
EMPTY_FOUNDRY_APPLICATION,
|
|
2534
|
+
TERMINAL_OCCURRENCE_STATUSES,
|
|
2535
|
+
activationScheduleRevision,
|
|
2536
|
+
scheduleOccurrenceId,
|
|
2537
|
+
firstScheduledTime,
|
|
2538
|
+
planScheduleOccurrence,
|
|
2539
|
+
matchesOccurrenceFilter,
|
|
2540
|
+
compareOccurrences,
|
|
2541
|
+
prunableOccurrences,
|
|
2542
|
+
assertScheduleOccurrence,
|
|
2420
2543
|
FOUNDRY_MODEL_REQUESTS_ENV,
|
|
2421
2544
|
requestTracer,
|
|
2422
2545
|
composeAgent,
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
FoundryRuntime,
|
|
4
4
|
FoundryServer,
|
|
5
5
|
writeGeneratedTypes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PMNRLJIQ.js";
|
|
7
7
|
import {
|
|
8
8
|
DEFAULT_FOUNDRY_CONFIG
|
|
9
9
|
} from "./chunk-ZFNMFE3T.js";
|
|
@@ -11,7 +11,7 @@ import "./chunk-J7ZBJM54.js";
|
|
|
11
11
|
import {
|
|
12
12
|
EMPTY_FOUNDRY_APPLICATION,
|
|
13
13
|
isFoundryApplication
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-T6YLIGER.js";
|
|
15
15
|
import "./chunk-J6NHL4SM.js";
|
|
16
16
|
import "./chunk-CYOIHSUX.js";
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StoreAdapter, AgentEvent, Message, TokenConsumptionCounter } from 'glove-core';
|
|
2
|
-
import {
|
|
2
|
+
import { x as AccountId, o as AccountReference, y as AccountNotFound, d1 as TransmissionId, cV as RouteId, cU as Route, cW as RouteNotFound, c_ as TopologyConflict, a3 as BindingId, q as AgentBinding, a4 as BindingNotFound, Q as AgentId, ax as EventReference, av as EventId, aw as EventNotFound, cY as RunId, z as AccountSessionUnavailable, b as FoundryDataAdapter, bB as FoundryInstanceProvisioner, j as FoundryApproval, a$ as FoundryAgentDefinition, cX as RunGrant, cx as GrantResolutionError, n as AnyFoundryTransmission, bg as FoundryCapabilityRegistry, bZ as FoundryNativeRegistry, c5 as FoundryRequest, a9 as CreateAgentInstanceOptions, c as AgentInstance, bV as FoundryMessageOptions, V as AgentMessageReceipt, br as FoundryEventTarget, bq as FoundryEventPolicy, C as Conversation, f as FoundryEventRecord, d as FoundryActivationRecord, i as FoundryPendingInbound, l as FoundryTask, S as SharedInboxItem, aa as CreateConversationOptions, m as AgentPlaybook, P as PlaybookSubscription, al as DefinePlaybookSubscriptionOptions, a1 as ApplicationConnectionState, d5 as UpdateAgentInstanceOptions, d6 as UpdateConversationOptions, W as WorkspaceEntry, E as EnvironmentValue, bU as FoundryMessageInput, c8 as FoundryResult, b9 as FoundryApprovalStatus, b6 as FoundryApprovalDecision, be as FoundryCapabilityManifest, bX as FoundryNativeManifest, T as AgentInstallation, bo as FoundryDelegationStatus, bm as FoundryDelegation, bT as FoundryMeshThreadStatus, bS as FoundryMeshThread, h as FoundryScheduleOccurrenceFilter, g as FoundryScheduleOccurrence, c9 as FoundryRouteMap, B as AccountSummary, _ as AnyFoundryAgent } from './event-delivery-a9B1Qq_u.js';
|
|
3
3
|
import * as effect_Brand from 'effect/Brand';
|
|
4
4
|
import { Context, Effect, Layer, Schema } from 'effect';
|
|
5
5
|
import { FoundryStationDaemonAdapter } from './station.js';
|
|
@@ -423,13 +423,20 @@ declare class FoundryRuntime {
|
|
|
423
423
|
private readonly execution;
|
|
424
424
|
private readonly observer;
|
|
425
425
|
private readonly signalRunner;
|
|
426
|
-
private readonly scheduleAdapter;
|
|
427
426
|
private readonly services;
|
|
428
427
|
private readonly runnerLoops;
|
|
429
428
|
private readonly materializedActivations;
|
|
430
429
|
private readonly activationTransitions;
|
|
431
430
|
private readonly activationDispatches;
|
|
432
431
|
private readonly activationTimers;
|
|
432
|
+
/** Occurrences when the data adapter does not store them. */
|
|
433
|
+
private readonly memoryOccurrences;
|
|
434
|
+
/** Occurrences this process handed (or is handing) to a run. */
|
|
435
|
+
private readonly occurrencesInHand;
|
|
436
|
+
/** Run id to the occurrence it delivers. */
|
|
437
|
+
private readonly occurrenceRuns;
|
|
438
|
+
/** How recent runs settled, for an occurrence recorded after its run already finished. */
|
|
439
|
+
private readonly recentlySettledRuns;
|
|
433
440
|
/** Whether each run's child process still holds its conversation, from FOUNDRY_RUN_PROCESS_EVENT. */
|
|
434
441
|
private readonly runProcesses;
|
|
435
442
|
private readonly approvalDirectory;
|
|
@@ -797,7 +804,6 @@ declare class FoundryRuntime {
|
|
|
797
804
|
private executeCoreCommandUnlocked;
|
|
798
805
|
private syncAgentPlaybooks;
|
|
799
806
|
private assertActivationOwnership;
|
|
800
|
-
private backendScheduleId;
|
|
801
807
|
private disarmActivation;
|
|
802
808
|
private syncDefinitionSchedules;
|
|
803
809
|
private updateScheduledActivation;
|
|
@@ -805,8 +811,36 @@ declare class FoundryRuntime {
|
|
|
805
811
|
private resumeScheduledActivation;
|
|
806
812
|
private cancelScheduledActivation;
|
|
807
813
|
private reconstructActivations;
|
|
814
|
+
/** List occurrences of schedules and sleeps: what came due, when it was meant for, and what became of it. */
|
|
815
|
+
listScheduleOccurrences(filter?: FoundryScheduleOccurrenceFilter): Promise<ReadonlyArray<FoundryScheduleOccurrence>>;
|
|
816
|
+
private durableOccurrences;
|
|
817
|
+
private claimOccurrence;
|
|
818
|
+
private putOccurrence;
|
|
819
|
+
private getOccurrence;
|
|
808
820
|
private materializeActivation;
|
|
809
|
-
|
|
821
|
+
/** A one-shot that fired before a restart: finish it if its occurrence has settled. */
|
|
822
|
+
private settleFiredOneShot;
|
|
823
|
+
/** Wait for the activation's cursor, then fire; repeat while it has one. */
|
|
824
|
+
private armActivation;
|
|
825
|
+
/**
|
|
826
|
+
* Take the occurrence at the activation's cursor: store it, then move the
|
|
827
|
+
* cursor past it, then hand it to a run. Returns the new cursor.
|
|
828
|
+
*/
|
|
829
|
+
private fireActivation;
|
|
830
|
+
private newOccurrence;
|
|
831
|
+
/**
|
|
832
|
+
* Hand an occurrence to its conversation. Runs under the activation lock,
|
|
833
|
+
* so a pause or cancel never sees it half handed over.
|
|
834
|
+
*/
|
|
835
|
+
private deliverOccurrence;
|
|
836
|
+
/** The run handling an occurrence settled. A run stopped by shutdown did not: the next start delivers it again. */
|
|
837
|
+
private settleOccurrence;
|
|
838
|
+
/**
|
|
839
|
+
* After a restart: hand over every occurrence a previous process claimed
|
|
840
|
+
* and no run finished, unless its activation has since been paused,
|
|
841
|
+
* cancelled or changed.
|
|
842
|
+
*/
|
|
843
|
+
private replayScheduleOccurrences;
|
|
810
844
|
private deliverOutbound;
|
|
811
845
|
private executionEnvelope;
|
|
812
846
|
private toFoundryRun;
|
|
@@ -920,6 +954,8 @@ declare class FoundryClient<TRoutes extends FoundryRouteMap> {
|
|
|
920
954
|
}): Promise<ReadonlyArray<FoundryRun>>;
|
|
921
955
|
playbookSubscriptions(workspaceId?: string): Promise<ReadonlyArray<PlaybookSubscription>>;
|
|
922
956
|
activations(workspaceId?: string): Promise<ReadonlyArray<FoundryActivationRecord>>;
|
|
957
|
+
/** Occurrences of schedules and sleeps: when each was meant for, the run that took it and how it ended. */
|
|
958
|
+
scheduleOccurrences(filter?: FoundryScheduleOccurrenceFilter): Promise<ReadonlyArray<FoundryScheduleOccurrence>>;
|
|
923
959
|
putPlaybookSubscription(subscription: PlaybookSubscription): Promise<PlaybookSubscription>;
|
|
924
960
|
deletePlaybookSubscription(id: string): Promise<boolean>;
|
|
925
961
|
applicationConnections(): Promise<ReadonlyArray<ApplicationConnectionState>>;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'glove-core';
|
|
2
|
-
import './event-delivery-
|
|
3
|
-
export { k as FoundryClient, l as FoundryClientAuthorizationAdapter, m as FoundryClientOptions, q as FoundryHealth, y as FoundryRunHandle, G as FoundrySteerHandleResult, W as WaitOptions, N as createFoundryClient } from './client-
|
|
2
|
+
import './event-delivery-a9B1Qq_u.js';
|
|
3
|
+
export { k as FoundryClient, l as FoundryClientAuthorizationAdapter, m as FoundryClientOptions, q as FoundryHealth, y as FoundryRunHandle, G as FoundrySteerHandleResult, W as WaitOptions, N as createFoundryClient } from './client-Cj2wDXuc.js';
|
|
4
4
|
import 'effect';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'glove-mesh';
|