@robota-sdk/agent-product 3.6.1 → 3.8.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/CHANGELOG.md +44 -0
- package/dist/coding/index.cjs +1 -1
- package/dist/coding/index.js +1 -1
- package/dist/command/index.cjs +1 -1
- package/dist/command/index.d.cts +19 -12
- package/dist/command/index.d.cts.map +1 -1
- package/dist/command/index.d.ts +19 -12
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +1 -1
- package/dist/command/node.d.cts +1 -1
- package/dist/command/node.d.ts +1 -1
- package/dist/command-BwqSJ1sX.js +123 -0
- package/dist/command-BwqSJ1sX.js.map +1 -0
- package/dist/{command--ag0fdHz.cjs → command-CZqe1Y9x.cjs} +77 -77
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +16 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +16 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{keybindings-command-module-CcA9-Xqi.d.cts → keybindings-command-module-DuL6bSYI.d.cts} +3 -3
- package/dist/{keybindings-command-module-CcA9-Xqi.d.cts.map → keybindings-command-module-DuL6bSYI.d.cts.map} +1 -1
- package/dist/{keybindings-command-module-CcA9-Xqi.d.ts → keybindings-command-module-DuL6bSYI.d.ts} +3 -3
- package/dist/{keybindings-command-module-CcA9-Xqi.d.ts.map → keybindings-command-module-DuL6bSYI.d.ts.map} +1 -1
- package/dist/personal/index.cjs +24 -24
- package/dist/personal/index.d.cts +418 -36
- package/dist/personal/index.d.cts.map +1 -1
- package/dist/personal/index.d.ts +418 -36
- package/dist/personal/index.d.ts.map +1 -1
- package/dist/personal/index.js +24 -24
- package/dist/personal/index.js.map +1 -1
- package/package.json +7 -7
- package/dist/command-BXOf0yNQ.js +0 -123
- package/dist/command-BXOf0yNQ.js.map +0 -1
|
@@ -68,6 +68,34 @@ interface IKnowledgeStore {
|
|
|
68
68
|
/** Rewrite the log keeping only the entries `keep` accepts: how forget reaches the log. */
|
|
69
69
|
rewriteLog(keep: (entry: IWikiLogEntry) => boolean): Promise<void>;
|
|
70
70
|
}
|
|
71
|
+
/** A piece of text a forget removed from the wiki: what a host must look for in its own copies. */
|
|
72
|
+
interface IForgottenText {
|
|
73
|
+
/** The statement of a removed claim, or the title of a page the forget deleted. */
|
|
74
|
+
readonly text: string;
|
|
75
|
+
/** A claim statement is a fact; a title is the name of a deleted page, mostly ordinary words. */
|
|
76
|
+
readonly kind: 'claim' | 'title';
|
|
77
|
+
/** The conversation a removed claim was learned in, when it recorded one. */
|
|
78
|
+
readonly sessionId?: string;
|
|
79
|
+
}
|
|
80
|
+
/** What a host managed to do about the copies of forgotten text it keeps. */
|
|
81
|
+
interface IForgetReachReport {
|
|
82
|
+
/** Records rewritten so they no longer hold the text. */
|
|
83
|
+
readonly cleaned: number;
|
|
84
|
+
/** Records that will be cleaned later, for example when a running turn ends. */
|
|
85
|
+
readonly pending: number;
|
|
86
|
+
/** Records that hold the text and could not be reached (held by another writer, unreadable). */
|
|
87
|
+
readonly notReached: number;
|
|
88
|
+
/** Names of the conversations the removed claims were learned in, for the answer to the person. */
|
|
89
|
+
readonly sources: readonly string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* What a host supplies so a forget reaches the copies the wiki does not own: the conversations the
|
|
93
|
+
* wiki was filled from. The wiki calls it after its own pages and log are clean; it never holds the
|
|
94
|
+
* conversations itself.
|
|
95
|
+
*/
|
|
96
|
+
interface IForgetReach {
|
|
97
|
+
reach(forgotten: readonly IForgottenText[]): Promise<IForgetReachReport>;
|
|
98
|
+
}
|
|
71
99
|
//#endregion
|
|
72
100
|
//#region src/personal/knowledge/wiki.d.ts
|
|
73
101
|
declare class SensitiveContentRefusedError extends Error {
|
|
@@ -116,16 +144,46 @@ interface IKnowledgeWikiOptions {
|
|
|
116
144
|
readonly now?: () => Date;
|
|
117
145
|
/** Claims on time-sensitive pages older than this are stale. Default 180 days. */
|
|
118
146
|
readonly staleAfterMs?: number;
|
|
147
|
+
/**
|
|
148
|
+
* Where what a forget removed is handed afterwards, so a host can reach the copies of it that it
|
|
149
|
+
* keeps (the conversations the wiki was filled from). Absent, a forget touches the wiki only.
|
|
150
|
+
*/
|
|
151
|
+
readonly reach?: IForgetReach;
|
|
152
|
+
}
|
|
153
|
+
type TForgetTarget = {
|
|
154
|
+
claimId: string;
|
|
155
|
+
} | {
|
|
156
|
+
claimIds: readonly string[];
|
|
157
|
+
} | {
|
|
158
|
+
pageId: string;
|
|
159
|
+
} | {
|
|
160
|
+
text: string;
|
|
161
|
+
};
|
|
162
|
+
interface IForgetResult {
|
|
163
|
+
/** How many claims were removed. */
|
|
164
|
+
readonly forgotten: number;
|
|
165
|
+
/** What the host's reach did about its copies; absent when no reach is configured. */
|
|
166
|
+
readonly conversations?: IForgetReachReport;
|
|
167
|
+
/** The reach threw: the forget still stands, and the host's copies may still hold the text. */
|
|
168
|
+
readonly reachFailed?: true;
|
|
119
169
|
}
|
|
120
170
|
declare function pageIdFor(title: string): string;
|
|
121
171
|
declare class KnowledgeWiki {
|
|
122
172
|
private readonly store;
|
|
123
173
|
private readonly now;
|
|
124
174
|
private readonly staleAfterMs;
|
|
175
|
+
private readonly reach;
|
|
125
176
|
private sequence;
|
|
126
177
|
constructor(options: IKnowledgeWikiOptions);
|
|
127
178
|
private claimId;
|
|
128
179
|
remember(raw: IRememberInput): Promise<IRememberResult>;
|
|
180
|
+
/**
|
|
181
|
+
* File a fact through the validated connector adapter. This path only accepts connector provenance
|
|
182
|
+
* and checks for secret values, so security vocabulary in an external fact is not refused. It is
|
|
183
|
+
* deliberately not exposed through the model-facing wiki tool; that path remains strict.
|
|
184
|
+
*/
|
|
185
|
+
rememberConnectorFact(raw: IRememberInput): Promise<IRememberResult>;
|
|
186
|
+
private rememberWithCheck;
|
|
129
187
|
read(id: string): Promise<IWikiPage | undefined>;
|
|
130
188
|
list(): Promise<readonly IWikiPage[]>;
|
|
131
189
|
search(query: string, limit?: number): Promise<readonly ISearchHit[]>;
|
|
@@ -136,18 +194,18 @@ declare class KnowledgeWiki {
|
|
|
136
194
|
/** Every page title and kind: what the model reads first, as an index. */
|
|
137
195
|
index(): Promise<string>;
|
|
138
196
|
/**
|
|
139
|
-
* Forget a claim by id, every claim on a page, or every current or retired
|
|
140
|
-
* `text`. Returns how many claims were removed. A page left with no claims is
|
|
141
|
-
* every link to it and every log entry that named it, since a page's id is its
|
|
142
|
-
* the fact itself.
|
|
197
|
+
* Forget a claim by id, several claims by id, every claim on a page, or every current or retired
|
|
198
|
+
* claim containing `text`. Returns how many claims were removed. A page left with no claims is
|
|
199
|
+
* deleted, and with it every link to it and every log entry that named it, since a page's id is its
|
|
200
|
+
* title and can carry the fact itself.
|
|
143
201
|
*/
|
|
144
|
-
forget(target:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
202
|
+
forget(target: TForgetTarget): Promise<number>;
|
|
203
|
+
/**
|
|
204
|
+
* Forget as `forget` does, then hand what was removed (every statement, current or retired, with
|
|
205
|
+
* its conversation, and the titles of deleted pages) to the host's reach once the pages and the log
|
|
206
|
+
* no longer hold it. A reach that fails is reported and never undoes the forget.
|
|
207
|
+
*/
|
|
208
|
+
forgetWithReport(target: TForgetTarget): Promise<IForgetResult>;
|
|
151
209
|
/** Link two existing pages, named by id or title; a link is always a page id, never free text. */
|
|
152
210
|
link(fromPage: string, toPage: string): Promise<void>;
|
|
153
211
|
/**
|
|
@@ -165,6 +223,27 @@ declare function createFileKnowledgeStore(directory: string): IKnowledgeStore;
|
|
|
165
223
|
//#region src/personal/knowledge/memory-store.d.ts
|
|
166
224
|
declare function createMemoryKnowledgeStore(): IKnowledgeStore;
|
|
167
225
|
//#endregion
|
|
226
|
+
//#region src/personal/knowledge/redaction.d.ts
|
|
227
|
+
/**
|
|
228
|
+
* Finding forgotten text inside a host's own copies. A copy rarely holds a statement byte for byte:
|
|
229
|
+
* a model may re-wrap it, change its case, or carry it inside a JSON-escaped tool argument. The
|
|
230
|
+
* redactor therefore matches across case, any run of whitespace, and the JSON-escaped form, and
|
|
231
|
+
* replaces only the matched span so the rest of the record stays as it was.
|
|
232
|
+
*/
|
|
233
|
+
/** What replaces a removed span. The wiki instructions tell the model never to guess or restore it. */
|
|
234
|
+
declare const FORGOTTEN_MARKER = "[forgotten]";
|
|
235
|
+
/**
|
|
236
|
+
* Whether a text is distinctive enough to be searched in conversations other than its own: ordinary
|
|
237
|
+
* short phrases ("tea", "Mina") would damage unrelated text everywhere.
|
|
238
|
+
*/
|
|
239
|
+
declare function isSpecificText(text: string): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* A function that replaces every occurrence of any of the texts with the forgotten marker. It matches
|
|
242
|
+
* case-insensitively, lets any whitespace run stand for any other, also finds the JSON-escaped form
|
|
243
|
+
* of a text, and does not match inside a longer word ("Mina" is not found in "Minasian").
|
|
244
|
+
*/
|
|
245
|
+
declare function createForgottenTextRedactor(texts: readonly string[]): (value: string) => string;
|
|
246
|
+
//#endregion
|
|
168
247
|
//#region src/personal/knowledge/render.d.ts
|
|
169
248
|
declare function renderPageMarkdown(page: IWikiPage): string;
|
|
170
249
|
/**
|
|
@@ -295,6 +374,27 @@ interface IGoal {
|
|
|
295
374
|
readonly connectorId?: string;
|
|
296
375
|
/** The case this goal gives a turn on, when it is one: found by this id, and run again for each answer. */
|
|
297
376
|
readonly caseId?: string;
|
|
377
|
+
/**
|
|
378
|
+
* The launch this goal was made for, when it was made by a host that records the person's requests:
|
|
379
|
+
* a typed mark, never text in the instructions. One launch id has one goal, so a host that stopped
|
|
380
|
+
* between making the goal and recording it finds this one again.
|
|
381
|
+
*/
|
|
382
|
+
readonly launch?: {
|
|
383
|
+
readonly id: string;
|
|
384
|
+
};
|
|
385
|
+
/** An accepted case answer awaiting a turn, owned by the agent holding its authority snapshot. */
|
|
386
|
+
readonly pendingCaseAnswer?: {
|
|
387
|
+
readonly feedItemId: string;
|
|
388
|
+
readonly ownerId: string;
|
|
389
|
+
};
|
|
390
|
+
/** The agent and answer associated with a claimed case turn. */
|
|
391
|
+
readonly activeCaseRun?: {
|
|
392
|
+
readonly runId: string;
|
|
393
|
+
readonly ownerId: string;
|
|
394
|
+
readonly answerId: string;
|
|
395
|
+
};
|
|
396
|
+
/** The most recent case answer whose turn has started. */
|
|
397
|
+
readonly lastCaseAnswerId?: string;
|
|
298
398
|
readonly status: TGoalStatus;
|
|
299
399
|
/** When the goal is next due (ISO 8601); absent when it is not scheduled. */
|
|
300
400
|
readonly nextRunAt?: string;
|
|
@@ -314,6 +414,10 @@ type TGoalRunOutcome = 'done' | 'failed' | 'interrupted';
|
|
|
314
414
|
interface IGoalRun {
|
|
315
415
|
readonly id: string;
|
|
316
416
|
readonly goalId: string;
|
|
417
|
+
readonly caseAnswerId?: string;
|
|
418
|
+
readonly caseOwnerId?: string;
|
|
419
|
+
readonly resumeAfterShutdown?: true;
|
|
420
|
+
readonly caseReport?: 'pending' | 'recorded' | 'quiet';
|
|
317
421
|
readonly startedAt: string;
|
|
318
422
|
readonly endedAt?: string;
|
|
319
423
|
readonly outcome?: TGoalRunOutcome;
|
|
@@ -366,6 +470,8 @@ interface IFeedItem {
|
|
|
366
470
|
}
|
|
367
471
|
/** Where goals, their runs and the feed live; a host supplies one per principal. */
|
|
368
472
|
interface IGoalStore {
|
|
473
|
+
/** The file store synchronizes feed replacements before exposing them to a host. */
|
|
474
|
+
readonly durableFeedWrites?: true;
|
|
369
475
|
listGoals(): Promise<readonly IGoal[]>;
|
|
370
476
|
getGoal(id: string): Promise<IGoal | undefined>;
|
|
371
477
|
putGoal(goal: IGoal): Promise<void>;
|
|
@@ -373,7 +479,9 @@ interface IGoalStore {
|
|
|
373
479
|
putRun(run: IGoalRun): Promise<void>;
|
|
374
480
|
/** A goal's runs, newest first. */
|
|
375
481
|
listRuns(goalId: string, limit: number): Promise<readonly IGoalRun[]>;
|
|
376
|
-
putFeedItem(item: IFeedItem
|
|
482
|
+
putFeedItem(item: IFeedItem, options?: {
|
|
483
|
+
readonly cancelApproved?: boolean;
|
|
484
|
+
}): Promise<void>;
|
|
377
485
|
getFeedItem(id: string): Promise<IFeedItem | undefined>;
|
|
378
486
|
/** Feed items, newest first. */
|
|
379
487
|
listFeed(limit: number): Promise<readonly IFeedItem[]>;
|
|
@@ -383,6 +491,10 @@ interface IGoalStore {
|
|
|
383
491
|
interface IGoalBookOptions {
|
|
384
492
|
readonly store: IGoalStore;
|
|
385
493
|
readonly now?: () => Date;
|
|
494
|
+
/** Serialize goal and run mutations across hosts sharing the store. */
|
|
495
|
+
readonly withWriteLock?: <T>(work: () => Promise<T>) => Promise<T>;
|
|
496
|
+
/** Coordinate removing a goal with the host's pending work for it. */
|
|
497
|
+
readonly withRemoveLock?: (id: string, work: () => Promise<void>) => Promise<void>;
|
|
386
498
|
}
|
|
387
499
|
interface ICreateGoalInput {
|
|
388
500
|
readonly title: string;
|
|
@@ -391,34 +503,72 @@ interface ICreateGoalInput {
|
|
|
391
503
|
readonly readOnly?: boolean;
|
|
392
504
|
readonly connectorId?: string;
|
|
393
505
|
readonly caseId?: string;
|
|
506
|
+
/**
|
|
507
|
+
* The launch this goal is made for. A goal that already carries this id is returned instead of a
|
|
508
|
+
* second one, under the same lock every goal write takes.
|
|
509
|
+
*/
|
|
510
|
+
readonly launch?: {
|
|
511
|
+
readonly id: string;
|
|
512
|
+
};
|
|
394
513
|
}
|
|
395
514
|
declare class GoalRefusedError extends Error {
|
|
396
515
|
constructor(reason: string);
|
|
397
516
|
}
|
|
398
517
|
declare class GoalBook {
|
|
518
|
+
/** This book allocates feed identifiers independently across host processes. */
|
|
519
|
+
readonly usesUniqueFeedIds: true;
|
|
520
|
+
readonly supportsSharedGoalLock: true;
|
|
521
|
+
readonly supportsCaseAnswerQueue: true;
|
|
522
|
+
readonly supportsCaseInterruptionRecovery: true;
|
|
523
|
+
readonly supportsCaseRunOwnership: true;
|
|
524
|
+
readonly supportsCaseReportRecovery: true;
|
|
525
|
+
readonly supportsCaseRunIdentityRecovery: true;
|
|
526
|
+
readonly supportsCoordinatedRemoval: true;
|
|
399
527
|
private readonly store;
|
|
400
528
|
private readonly now;
|
|
529
|
+
private readonly withWriteLock;
|
|
530
|
+
private readonly withRemoveLock;
|
|
531
|
+
private tail;
|
|
401
532
|
private sequence;
|
|
402
533
|
constructor(options: IGoalBookOptions);
|
|
534
|
+
private exclusive;
|
|
403
535
|
private stamp;
|
|
404
536
|
private mint;
|
|
405
537
|
private require;
|
|
406
538
|
private save;
|
|
407
539
|
create(input: ICreateGoalInput): Promise<IGoal>;
|
|
540
|
+
private createUnlocked;
|
|
541
|
+
/** Queue one answer for the agent holding its answer-time authority. */
|
|
542
|
+
enqueueCaseAnswer(input: {
|
|
543
|
+
readonly caseId: string;
|
|
544
|
+
readonly feedItemId: string;
|
|
545
|
+
readonly ownerId: string;
|
|
546
|
+
readonly title: string;
|
|
547
|
+
readonly instructions: string;
|
|
548
|
+
}): Promise<IGoal>;
|
|
549
|
+
/** Transfer only a still-pending answer whose original owner has been proven stopped. */
|
|
550
|
+
adoptCaseAnswer(id: string, previousOwner: string, ownerId: string): Promise<boolean>;
|
|
551
|
+
private settleUnclaimedCaseRun;
|
|
552
|
+
/** Recover a case run only after its particular owner has been proven stopped. */
|
|
553
|
+
recoverCaseOwner(id: string, previousOwner: string, ownerId: string, expectedRunId: string): Promise<boolean>;
|
|
554
|
+
private recordCaseReport;
|
|
408
555
|
list(): Promise<readonly IGoal[]>;
|
|
409
556
|
get(id: string): Promise<IGoal | undefined>;
|
|
410
557
|
runs(goalId: string, limit?: number): Promise<readonly IGoalRun[]>;
|
|
411
558
|
/** Goals due now: active and scheduled at or before this moment. */
|
|
412
559
|
due(): Promise<readonly IGoal[]>;
|
|
413
560
|
pause(id: string): Promise<IGoal>;
|
|
561
|
+
private pauseUnlocked;
|
|
414
562
|
/**
|
|
415
563
|
* Change how often a goal repeats. A run in progress keeps going and the next one follows the new
|
|
416
564
|
* interval; otherwise the goal is active again and due that long after its last run (at once if it
|
|
417
565
|
* never ran or that moment has passed).
|
|
418
566
|
*/
|
|
419
567
|
reschedule(id: string, everyMinutes: number): Promise<IGoal>;
|
|
568
|
+
private rescheduleUnlocked;
|
|
420
569
|
/** Make a paused, finished or failed goal due now. */
|
|
421
570
|
resume(id: string): Promise<IGoal>;
|
|
571
|
+
private resumeUnlocked;
|
|
422
572
|
/**
|
|
423
573
|
* Make a goal that has finished due now again, as a one-shot goal's next turn: a case's goal runs once
|
|
424
574
|
* for each answer. A goal still running or waiting is refused, since a second run would start before
|
|
@@ -426,10 +576,18 @@ declare class GoalBook {
|
|
|
426
576
|
* is untouched, so a scheduled goal follows its own schedule again once the extra run ends.
|
|
427
577
|
*/
|
|
428
578
|
runAgain(id: string): Promise<IGoal>;
|
|
579
|
+
private runAgainUnlocked;
|
|
429
580
|
remove(id: string): Promise<void>;
|
|
430
|
-
|
|
581
|
+
private removeUnlocked;
|
|
582
|
+
startRun(goalId: string, options?: {
|
|
583
|
+
readonly requireDue?: boolean;
|
|
584
|
+
readonly ownerId?: string;
|
|
585
|
+
}): Promise<IGoalRun>;
|
|
586
|
+
private startRunUnlocked;
|
|
431
587
|
recordAction(run: IGoalRun, action: Omit<IGoalAction, 'at'>): Promise<IGoalRun>;
|
|
588
|
+
private recordActionUnlocked;
|
|
432
589
|
setWaiting(goalId: string, waiting: boolean): Promise<void>;
|
|
590
|
+
private setWaitingUnlocked;
|
|
433
591
|
/** End a run, schedule the next one or close the goal, and report to the feed. */
|
|
434
592
|
/**
|
|
435
593
|
* End a run. A `quiet` run that went well is kept in the goal's history but is not posted to the
|
|
@@ -437,16 +595,31 @@ declare class GoalBook {
|
|
|
437
595
|
*/
|
|
438
596
|
finishRun(run: IGoalRun, outcome: TGoalRunOutcome, report: string, options?: {
|
|
439
597
|
readonly quiet?: boolean;
|
|
598
|
+
readonly resumeCaseOwner?: string;
|
|
440
599
|
}): Promise<IGoalRun>;
|
|
600
|
+
private finishRunUnlocked;
|
|
441
601
|
/**
|
|
442
602
|
* After the host restarts, nothing is running: a goal it was running is due again, and an approval
|
|
443
603
|
* it was waiting on can no longer be answered.
|
|
444
604
|
*/
|
|
445
605
|
recover(): Promise<number>;
|
|
606
|
+
private recoverUnlocked;
|
|
607
|
+
/** Recover one goal only when its host has proved no live agent owns it. */
|
|
608
|
+
recoverGoal(id: string, options?: {
|
|
609
|
+
readonly adoptOwner?: string;
|
|
610
|
+
}): Promise<boolean>;
|
|
611
|
+
private recoverGoalUnlocked;
|
|
446
612
|
post(item: Omit<IFeedItem, 'id' | 'at' | 'dismissed'>): Promise<IFeedItem>;
|
|
447
613
|
feed(limit?: number): Promise<readonly IFeedItem[]>;
|
|
448
614
|
feedItem(id: string): Promise<IFeedItem | undefined>;
|
|
449
615
|
setApproval(id: string, state: TApprovalState): Promise<IFeedItem>;
|
|
616
|
+
/** Expire this exact approval after its prompt was cancelled before the action could start. */
|
|
617
|
+
cancelApproval(id: string, expected: {
|
|
618
|
+
readonly goalId: string | undefined;
|
|
619
|
+
readonly runId: string | undefined;
|
|
620
|
+
readonly tool: string;
|
|
621
|
+
readonly detail: string;
|
|
622
|
+
}): Promise<void>;
|
|
450
623
|
/** Record the person's answer to a question; a question is answered once. */
|
|
451
624
|
answerQuestion(id: string, answer: Omit<IQuestionAnswer, 'at'>): Promise<IFeedItem>;
|
|
452
625
|
/** Show how the case closed under the person's answer; only an answered question carries one. */
|
|
@@ -535,8 +708,16 @@ interface ICaseAskedEvent {
|
|
|
535
708
|
readonly item: IFeedItem;
|
|
536
709
|
readonly urgency: TCaseUrgency;
|
|
537
710
|
}
|
|
711
|
+
interface ICaseAnswerEvent {
|
|
712
|
+
readonly before: ICase;
|
|
713
|
+
readonly after: ICase;
|
|
714
|
+
readonly item: IFeedItem;
|
|
715
|
+
readonly answer: IAnswerInput;
|
|
716
|
+
}
|
|
538
717
|
interface ICaseBookOptions {
|
|
539
718
|
readonly store: ICaseStore;
|
|
719
|
+
/** Serialize complete case mutations across hosts that share the store and feed. */
|
|
720
|
+
readonly withWriteLock?: <T>(work: () => Promise<T>) => Promise<T>;
|
|
540
721
|
/** Where a question is shown to the person, and where their answer is recorded. */
|
|
541
722
|
readonly feed: GoalBook;
|
|
542
723
|
/**
|
|
@@ -544,6 +725,14 @@ interface ICaseBookOptions {
|
|
|
544
725
|
* question is already in the feed when this runs, whatever the host does about telling the person.
|
|
545
726
|
*/
|
|
546
727
|
readonly onAsked?: (event: ICaseAskedEvent) => void | Promise<void>;
|
|
728
|
+
/** Called after a case has closed and its write lock has been released. */
|
|
729
|
+
readonly onClosed?: (closed: ICase) => void | Promise<void>;
|
|
730
|
+
readonly answerHooks?: {
|
|
731
|
+
before(feedItemId: string): Promise<void>;
|
|
732
|
+
prepare(event: ICaseAnswerEvent): Promise<void>;
|
|
733
|
+
persistCase(): Promise<void>;
|
|
734
|
+
committed(event: ICaseAnswerEvent, context: unknown): Promise<void>;
|
|
735
|
+
};
|
|
547
736
|
readonly now?: () => Date;
|
|
548
737
|
}
|
|
549
738
|
interface IOpenCaseInput {
|
|
@@ -567,11 +756,17 @@ interface IAnswerInput {
|
|
|
567
756
|
readonly reply?: string;
|
|
568
757
|
}
|
|
569
758
|
declare class CaseBook {
|
|
759
|
+
/** This book serializes a complete mutation with the host's write lock. */
|
|
760
|
+
readonly supportsSharedWriteLock: true;
|
|
761
|
+
readonly supportsCaseAnswerHooks: true;
|
|
762
|
+
readonly supportsAnswerScopedWrites: true;
|
|
570
763
|
private readonly store;
|
|
571
764
|
private readonly feed;
|
|
572
765
|
private readonly onAsked;
|
|
766
|
+
private readonly onClosed;
|
|
767
|
+
private readonly answerHooks;
|
|
573
768
|
private readonly now;
|
|
574
|
-
private
|
|
769
|
+
private readonly withWriteLock;
|
|
575
770
|
private tail;
|
|
576
771
|
constructor(options: ICaseBookOptions);
|
|
577
772
|
/** Tell the host a question was asked, without waiting for it and without letting it fail the ask. */
|
|
@@ -589,9 +784,14 @@ declare class CaseBook {
|
|
|
589
784
|
readonly case: ICase;
|
|
590
785
|
readonly existing: boolean;
|
|
591
786
|
}>;
|
|
592
|
-
|
|
787
|
+
private requireAnswer;
|
|
788
|
+
note(id: string, text: string, options?: {
|
|
789
|
+
readonly answerId: string;
|
|
790
|
+
}): Promise<ICase>;
|
|
593
791
|
/** Ask the person the case's one question; it shows in their feed with the notes as its evidence. */
|
|
594
|
-
ask(id: string, input: IAskInput
|
|
792
|
+
ask(id: string, input: IAskInput, scope?: {
|
|
793
|
+
readonly answerId: string;
|
|
794
|
+
}): Promise<{
|
|
595
795
|
readonly case: ICase;
|
|
596
796
|
readonly item: IFeedItem;
|
|
597
797
|
}>;
|
|
@@ -599,7 +799,9 @@ declare class CaseBook {
|
|
|
599
799
|
* Record the person's answer to a question in the feed: one of its choices, or a reply when the
|
|
600
800
|
* question allows one. The case moves on with no question waiting; what to do next is not decided here.
|
|
601
801
|
*/
|
|
602
|
-
answer(feedItemId: string, input: IAnswerInput
|
|
802
|
+
answer(feedItemId: string, input: IAnswerInput, options?: {
|
|
803
|
+
readonly context: unknown;
|
|
804
|
+
}): Promise<{
|
|
603
805
|
readonly case: ICase;
|
|
604
806
|
readonly item: IFeedItem;
|
|
605
807
|
}>;
|
|
@@ -611,7 +813,9 @@ declare class CaseBook {
|
|
|
611
813
|
* still waits on a visible card, and if the withdrawal fails the case is closed and its card is
|
|
612
814
|
* withdrawn when the person next answers it.
|
|
613
815
|
*/
|
|
614
|
-
close(id: string, resolution: string
|
|
816
|
+
close(id: string, resolution: string, options?: {
|
|
817
|
+
readonly answerId: string;
|
|
818
|
+
}): Promise<ICase>;
|
|
615
819
|
/**
|
|
616
820
|
* The card shows a copy of what the closed case already holds, so a card that cannot take it is left
|
|
617
821
|
* as it is: failing the close here would tell the agent a close that happened had not, and a second
|
|
@@ -634,15 +838,17 @@ declare const CASE_TOOL_NAMES: {
|
|
|
634
838
|
readonly ask: "CaseAsk";
|
|
635
839
|
readonly close: "CaseClose";
|
|
636
840
|
};
|
|
637
|
-
declare function createCaseTools(book: CaseBook
|
|
841
|
+
declare function createCaseTools(book: CaseBook, scope?: {
|
|
842
|
+
readonly caseId: string;
|
|
843
|
+
readonly answerId: string;
|
|
844
|
+
}): FunctionTool[];
|
|
638
845
|
declare const CASE_INSTRUCTIONS: string;
|
|
639
846
|
//#endregion
|
|
640
847
|
//#region src/personal/cases/turn.d.ts
|
|
641
848
|
/**
|
|
642
|
-
* The
|
|
643
|
-
* related,
|
|
644
|
-
*
|
|
645
|
-
* tool added later is then not offered until it is named.
|
|
849
|
+
* The tools a case turn has by default: it may look at the connector and the library to check
|
|
850
|
+
* something related, keep the case, and propose an offer the host will check. A host may add its own
|
|
851
|
+
* scoped action separately.
|
|
646
852
|
*/
|
|
647
853
|
declare function caseTurnTools(): string[];
|
|
648
854
|
/**
|
|
@@ -656,7 +862,68 @@ declare function caseTurnPrompt(): string;
|
|
|
656
862
|
* come after the label that says so, and the directions come after them; only the case id and the
|
|
657
863
|
* person's own answer stand before it.
|
|
658
864
|
*/
|
|
659
|
-
declare function caseTurnInstructions(found: ICase
|
|
865
|
+
declare function caseTurnInstructions(found: ICase, options?: {
|
|
866
|
+
readonly allowApprovedActions?: boolean;
|
|
867
|
+
}): string;
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/personal/secret-values.d.ts
|
|
870
|
+
/**
|
|
871
|
+
* Whether a text carries a secret value. A word the shared secret check flags by its vocabulary alone,
|
|
872
|
+
* in any language it knows, is set aside before the check looks at what remains, which still refuses
|
|
873
|
+
* credential prefixes, key blocks, tokens and card or identity numbers by their shape. A set-aside word
|
|
874
|
+
* followed by `:` or `=` and a value is a secret written out, so that is refused as well.
|
|
875
|
+
*
|
|
876
|
+
* Accepted residual risk: a short, low-entropy value written as plain prose ("my password is hunter2")
|
|
877
|
+
* has no shape to recognise and is not refused. The realistic accidental pastes (keys, tokens, card and
|
|
878
|
+
* identity numbers) are.
|
|
879
|
+
*/
|
|
880
|
+
declare function carriesSecretValue(text: string): boolean;
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region src/personal/offers/types.d.ts
|
|
883
|
+
/**
|
|
884
|
+
* What the agent hands the host when it proposes a task offer. The pack owns no catalog: a proposal
|
|
885
|
+
* names a task by id and revision, where the agent saw the reason for it, and why acting may help; the
|
|
886
|
+
* host decides whether it becomes an offer and answers in plain words.
|
|
887
|
+
*/
|
|
888
|
+
/** Where the agent saw the reason for an offer: a kind, the service and item it came from, and when. */
|
|
889
|
+
interface IOfferSourceRef {
|
|
890
|
+
/** What kind of place it was, such as a connected service; the host decides which kinds it accepts. */
|
|
891
|
+
readonly kind: string;
|
|
892
|
+
readonly connectorId?: string;
|
|
893
|
+
/** The same reference for the same item every time, so one source matter makes one offer. */
|
|
894
|
+
readonly sourceItemId?: string;
|
|
895
|
+
/** When the agent read it, as a UTC time such as 2026-01-31T09:00:00Z. */
|
|
896
|
+
readonly observedAt: string;
|
|
897
|
+
}
|
|
898
|
+
interface IOfferCandidate {
|
|
899
|
+
readonly definitionId: string;
|
|
900
|
+
readonly definitionRevision: number;
|
|
901
|
+
readonly source: IOfferSourceRef;
|
|
902
|
+
/** What the source says, as a short factual statement. */
|
|
903
|
+
readonly basis: string;
|
|
904
|
+
/** Why acting now may help the person, in one short sentence. */
|
|
905
|
+
readonly why: string;
|
|
906
|
+
/** Values the person may use to start the task; suggestions only, which the person reads and changes. */
|
|
907
|
+
readonly suggestedInputs?: Readonly<Record<string, string>>;
|
|
908
|
+
}
|
|
909
|
+
/** The host's answer: the offer that now holds the proposal, or the reason it did not. */
|
|
910
|
+
type TOfferProposal = {
|
|
911
|
+
readonly status: 'accepted';
|
|
912
|
+
readonly offerId: string;
|
|
913
|
+
} | {
|
|
914
|
+
readonly status: 'rejected';
|
|
915
|
+
readonly reason: string;
|
|
916
|
+
};
|
|
917
|
+
/** The host's side of a proposal. It judges, stores and answers; the agent never sees more than the answer. */
|
|
918
|
+
interface IOfferProposer {
|
|
919
|
+
propose(candidate: IOfferCandidate): Promise<TOfferProposal>;
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/personal/offers/tools.d.ts
|
|
923
|
+
declare const OFFER_TOOL_NAMES: {
|
|
924
|
+
readonly propose: "TaskOfferPropose";
|
|
925
|
+
};
|
|
926
|
+
declare function createOfferTools(proposer: IOfferProposer): FunctionTool[];
|
|
660
927
|
//#endregion
|
|
661
928
|
//#region src/personal/delivery/types.d.ts
|
|
662
929
|
/** Times are `HH:MM` on a 24-hour clock, in the local time of the machine that runs the agent. */
|
|
@@ -688,12 +955,20 @@ interface IDeliveryState {
|
|
|
688
955
|
readonly digestedOn?: string;
|
|
689
956
|
/** Feed items waiting for the next digest. */
|
|
690
957
|
readonly pendingDigest: readonly string[];
|
|
958
|
+
/** When a source last had an offer pushed, by source key; at most a few dozen, the oldest dropped. */
|
|
959
|
+
readonly offerSources?: Readonly<Record<string, string>>;
|
|
960
|
+
/** Offers waiting for the next digest, by id, with the title the host verified. */
|
|
961
|
+
readonly pendingOffers?: readonly IPendingOffer[];
|
|
691
962
|
}
|
|
692
|
-
|
|
963
|
+
interface IPendingOffer {
|
|
964
|
+
readonly offerId: string;
|
|
965
|
+
readonly title: string;
|
|
966
|
+
}
|
|
967
|
+
/** What becomes of one question or offer: pushed now, held for the daily summary, or left in the feed. */
|
|
693
968
|
type TDelivery = 'notify' | 'digest' | 'feed';
|
|
694
969
|
interface IDeliveryMessage {
|
|
695
970
|
/** A `test` message is the person's own check that a sink works; it is never a question. */
|
|
696
|
-
readonly kind: 'question' | 'digest' | 'test';
|
|
971
|
+
readonly kind: 'question' | 'offer' | 'digest' | 'test';
|
|
697
972
|
/** A short plain line that says what the message is about, for a sink that shows a heading. */
|
|
698
973
|
readonly title: string;
|
|
699
974
|
/** Plain text on one or a few lines; a sink adds nothing to it. */
|
|
@@ -723,6 +998,8 @@ interface IDeliveryStatus {
|
|
|
723
998
|
};
|
|
724
999
|
/** Open questions held for the next digest. */
|
|
725
1000
|
readonly waitingInDigest: number;
|
|
1001
|
+
/** Offers held for the next digest that are still offered. */
|
|
1002
|
+
readonly offersWaitingInDigest: number;
|
|
726
1003
|
}
|
|
727
1004
|
/** The feed as delivery needs it: a card, looked up again before a digest names it. */
|
|
728
1005
|
interface IDeliveryFeed {
|
|
@@ -878,6 +1155,8 @@ declare class NotificationAddress {
|
|
|
878
1155
|
}
|
|
879
1156
|
//#endregion
|
|
880
1157
|
//#region src/personal/delivery/question-delivery.d.ts
|
|
1158
|
+
/** A source that had an offer pushed waits this long before another of its offers is pushed. */
|
|
1159
|
+
declare const OFFER_SOURCE_COOLDOWN_MS: number;
|
|
881
1160
|
interface IQuestionDeliveryOptions {
|
|
882
1161
|
/** The person's limits; none stored means the defaults. */
|
|
883
1162
|
readonly settings: IDeliveryStore<IDeliverySettings>;
|
|
@@ -893,6 +1172,19 @@ interface IQuestionDeliveryOptions {
|
|
|
893
1172
|
readonly now?: () => Date;
|
|
894
1173
|
/** How long a sink may take before its attempt is given up. */
|
|
895
1174
|
readonly sinkTimeoutMs?: number;
|
|
1175
|
+
/** Whether a held offer is still offered; one that is not is left out of the digest. */
|
|
1176
|
+
readonly offers?: {
|
|
1177
|
+
stillOffered(offerId: string): boolean | Promise<boolean>;
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
interface IOfferDeliveryInput {
|
|
1181
|
+
readonly offerId: string;
|
|
1182
|
+
/** The title the host verified; nothing else about the offer is ever sent. */
|
|
1183
|
+
readonly title: string;
|
|
1184
|
+
/** Where the offer came from; one source is pushed at most once per cooldown. */
|
|
1185
|
+
readonly sourceKey: string;
|
|
1186
|
+
/** What the person chose for offers: a push, or only the digest. */
|
|
1187
|
+
readonly mode: 'notify' | 'digest';
|
|
896
1188
|
}
|
|
897
1189
|
declare class QuestionDelivery {
|
|
898
1190
|
private readonly options;
|
|
@@ -916,13 +1208,22 @@ declare class QuestionDelivery {
|
|
|
916
1208
|
* say; a push counts toward today's limit only when a sink took it.
|
|
917
1209
|
*/
|
|
918
1210
|
onAsked(event: ICaseAskedEvent): Promise<void>;
|
|
1211
|
+
/** The offers held for the digest that are still offered; the others drop out. */
|
|
1212
|
+
private stillOffered;
|
|
1213
|
+
/**
|
|
1214
|
+
* An offer the person chose to receive. It shares the daily limit and quiet hours with questions, and
|
|
1215
|
+
* a source that had one pushed waits a day for the next, so a push is a decision only the person's
|
|
1216
|
+
* limits make. Held offers wait for the digest or stay in the feed. Resolves to what was done: `feed`
|
|
1217
|
+
* also when a push was due but no sink took it.
|
|
1218
|
+
*/
|
|
1219
|
+
onOffer(input: IOfferDeliveryInput): Promise<TDelivery>;
|
|
919
1220
|
/**
|
|
920
1221
|
* Called every minute and once at start. Sends the day's one digest when its time has come, outside
|
|
921
|
-
* quiet hours, and some held question still waits for
|
|
1222
|
+
* quiet hours, and some held question or offer still waits for the person; then forgets what was held and
|
|
922
1223
|
* records the day, so a digest is attempted once a day.
|
|
923
1224
|
*/
|
|
924
1225
|
tick(): Promise<void>;
|
|
925
|
-
/** The person's limits, how many pushes are used today, and how many questions wait for the digest. */
|
|
1226
|
+
/** The person's limits, how many pushes are used today, and how many questions and offers wait for the digest. */
|
|
926
1227
|
status(): Promise<IDeliveryStatus>;
|
|
927
1228
|
/**
|
|
928
1229
|
* Change the person's limits: only what the change names, refused whole when any part is not valid.
|
|
@@ -1318,12 +1619,40 @@ interface IConnectorCallResult {
|
|
|
1318
1619
|
readonly text: string;
|
|
1319
1620
|
readonly isError: boolean;
|
|
1320
1621
|
}
|
|
1622
|
+
interface IConnectorDispatchRequest {
|
|
1623
|
+
readonly tool: string;
|
|
1624
|
+
readonly argumentsJson: string;
|
|
1625
|
+
}
|
|
1626
|
+
type TConnectorDispatchAdmission = (dispatch: () => Promise<unknown>, request: IConnectorDispatchRequest) => Promise<{
|
|
1627
|
+
readonly response: Promise<unknown>;
|
|
1628
|
+
}>;
|
|
1629
|
+
/** What came of trying to put a typed token in place of the one in use. */
|
|
1630
|
+
type IReplaceTokenOutcome = {
|
|
1631
|
+
readonly replaced: true;
|
|
1632
|
+
readonly status: IConnectorStatus;
|
|
1633
|
+
} | {
|
|
1634
|
+
readonly replaced: false;
|
|
1635
|
+
/** Why the new token was not taken: the service refused it, or could not be reached. */
|
|
1636
|
+
readonly reason: 'rejected' | 'unreachable';
|
|
1637
|
+
/** What the connection stands at: unchanged by the attempt. */
|
|
1638
|
+
readonly status: IConnectorStatus;
|
|
1639
|
+
};
|
|
1640
|
+
/** What the caller does at the moment a replacement is certain to take effect. */
|
|
1641
|
+
interface IReplaceTokenHooks {
|
|
1642
|
+
/**
|
|
1643
|
+
* Called once the service accepted the candidate and before it takes the old token's place. If it
|
|
1644
|
+
* throws, nothing is swapped.
|
|
1645
|
+
*/
|
|
1646
|
+
beforeSwap(): void;
|
|
1647
|
+
}
|
|
1321
1648
|
/**
|
|
1322
1649
|
* One protocol's way to reach a service. The composition root supplies it, because reaching a
|
|
1323
1650
|
* service needs a host (network, files, a browser sign-in), and the pack stays neutral.
|
|
1324
1651
|
*/
|
|
1325
1652
|
interface IConnectorProtocol {
|
|
1326
1653
|
readonly id: string;
|
|
1654
|
+
/** Guarded calls can be admitted at the final external handoff. */
|
|
1655
|
+
readonly admitsToolDispatch?: true;
|
|
1327
1656
|
status(connector: IConnector): Promise<IConnectorStatus>;
|
|
1328
1657
|
/**
|
|
1329
1658
|
* Start the person's sign-in. Returns at once with where their browser goes; the sign-in finishes
|
|
@@ -1332,9 +1661,17 @@ interface IConnectorProtocol {
|
|
|
1332
1661
|
signIn(connector: IConnector, context: ISignInContext): Promise<IConnectorStatus>;
|
|
1333
1662
|
/** Delete the credential first, then ask the service to revoke it. */
|
|
1334
1663
|
signOut(connector: IConnector): Promise<IDisconnectOutcome>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Replace the token in use with a new one the person typed, without disconnecting. The new token is
|
|
1666
|
+
* tried apart from the one in use and takes its place only when the service accepts it; a refusal or an
|
|
1667
|
+
* unreachable service leaves the token, the connection and its status as they were. A protocol that
|
|
1668
|
+
* cannot do this leaves it out.
|
|
1669
|
+
*/
|
|
1670
|
+
replaceToken?(connector: IConnector, token: string, hooks: IReplaceTokenHooks): Promise<IReplaceTokenOutcome>;
|
|
1335
1671
|
tools(connector: IConnector): Promise<readonly IConnectorToolInfo[]>;
|
|
1336
1672
|
call(connector: IConnector, tool: string, args: Readonly<Record<string, unknown>>, options?: {
|
|
1337
1673
|
readonly signal?: AbortSignal;
|
|
1674
|
+
readonly admitDispatch?: TConnectorDispatchAdmission;
|
|
1338
1675
|
}): Promise<IConnectorCallResult>;
|
|
1339
1676
|
/** Let go of what is held for a connector that is being removed. */
|
|
1340
1677
|
forget(connector: IConnector): Promise<void>;
|
|
@@ -1370,7 +1707,6 @@ interface ICreateConnectorInput {
|
|
|
1370
1707
|
declare class ConnectorBook {
|
|
1371
1708
|
private readonly store;
|
|
1372
1709
|
private readonly now;
|
|
1373
|
-
private sequence;
|
|
1374
1710
|
constructor(options: {
|
|
1375
1711
|
readonly store: IConnectorStore;
|
|
1376
1712
|
readonly now?: () => Date;
|
|
@@ -1455,6 +1791,8 @@ interface IConnectorRegistryOptions {
|
|
|
1455
1791
|
*/
|
|
1456
1792
|
declare function classifyTool(connector: IConnector, tool: IConnectorToolInfo): TToolAccess;
|
|
1457
1793
|
declare class ConnectorRegistry {
|
|
1794
|
+
/** This registry forwards guarded actions only to protocols that admit dispatch. */
|
|
1795
|
+
readonly forwardsDispatchAdmission: true;
|
|
1458
1796
|
private readonly book;
|
|
1459
1797
|
private readonly protocols;
|
|
1460
1798
|
private readonly cacheMs;
|
|
@@ -1468,9 +1806,17 @@ declare class ConnectorRegistry {
|
|
|
1468
1806
|
view(id: string, options?: {
|
|
1469
1807
|
readonly refresh?: boolean;
|
|
1470
1808
|
}): Promise<IConnectorView>;
|
|
1809
|
+
/** Read the local connection state without discovering tools from the service. */
|
|
1810
|
+
status(id: string): Promise<IConnectorStatus>;
|
|
1471
1811
|
list(): Promise<readonly IConnectorView[]>;
|
|
1472
1812
|
/** Start the person's sign-in; the answer says where their browser goes. */
|
|
1473
1813
|
signIn(id: string, context: ISignInContext): Promise<IConnectorStatus>;
|
|
1814
|
+
/**
|
|
1815
|
+
* Replace the token a `token` connector holds with a new one, keeping the connection. Only the
|
|
1816
|
+
* registry is asked, so a connector that does not sign in with a token, or a protocol that cannot
|
|
1817
|
+
* try a token apart from the one in use, is refused here and nowhere else.
|
|
1818
|
+
*/
|
|
1819
|
+
replaceToken(id: string, token: string, hooks: IReplaceTokenHooks): Promise<IReplaceTokenOutcome>;
|
|
1474
1820
|
disconnect(id: string): Promise<IDisconnectOutcome>;
|
|
1475
1821
|
/** Disconnect and forget a connector: the credential is deleted before anything else. */
|
|
1476
1822
|
remove(id: string): Promise<IDisconnectOutcome>;
|
|
@@ -1492,7 +1838,7 @@ declare class ConnectorRegistry {
|
|
|
1492
1838
|
/** Call a tool that only reads. A tool that writes is refused here, whatever the caller says it is. */
|
|
1493
1839
|
read(id: string, tool: string, args: Readonly<Record<string, unknown>>, signal?: AbortSignal): Promise<IConnectorCallResult>;
|
|
1494
1840
|
/** Call a tool that writes or sends. The person's approval is the caller's gate; a read tool is refused. */
|
|
1495
|
-
act(id: string, tool: string, args: Readonly<Record<string, unknown>>, signal?: AbortSignal): Promise<IConnectorCallResult>;
|
|
1841
|
+
act(id: string, tool: string, args: Readonly<Record<string, unknown>>, signal?: AbortSignal, admitDispatch?: TConnectorDispatchAdmission): Promise<IConnectorCallResult>;
|
|
1496
1842
|
close(): Promise<void>;
|
|
1497
1843
|
}
|
|
1498
1844
|
//#endregion
|
|
@@ -1502,7 +1848,13 @@ declare const CONNECTOR_TOOL_NAMES: {
|
|
|
1502
1848
|
readonly read: "ConnectorRead";
|
|
1503
1849
|
readonly act: "ConnectorAct";
|
|
1504
1850
|
readonly keep: "ConnectorKeep";
|
|
1851
|
+
readonly progress: "ConnectorSyncProgress";
|
|
1505
1852
|
};
|
|
1853
|
+
/**
|
|
1854
|
+
* The arguments of a remote tool arrive as JSON text: a tool's own input is whatever its service
|
|
1855
|
+
* declared, and the schema a model is offered carries only what every provider can enforce.
|
|
1856
|
+
*/
|
|
1857
|
+
declare function parseConnectorArguments(text: string | undefined): Record<string, unknown>;
|
|
1506
1858
|
declare function createConnectorTools(registry: ConnectorRegistry): FunctionTool[];
|
|
1507
1859
|
declare const CONNECTOR_INSTRUCTIONS: string;
|
|
1508
1860
|
//#endregion
|
|
@@ -1532,12 +1884,38 @@ declare const SYNC_MIN_MINUTES = 15;
|
|
|
1532
1884
|
declare const SYNC_MAX_MINUTES: number;
|
|
1533
1885
|
/**
|
|
1534
1886
|
* The only tools a sync run has. Content from the service is written by others, so a run can read it,
|
|
1535
|
-
* look in the library, add what it finds
|
|
1536
|
-
* else: it cannot change the service, reach the web or the files,
|
|
1537
|
-
* person said or set up goals. The case tools touch only the
|
|
1538
|
-
*
|
|
1887
|
+
* look in the library, add what it finds, keep a case on what the person should be asked and propose a task
|
|
1888
|
+
* offer the host will check, and nothing else: it cannot change the service, reach the web or the files,
|
|
1889
|
+
* drive the browser, rewrite what the person said or set up goals. The case and offer tools touch only the
|
|
1890
|
+
* agent's own record and the feed, and the progress tool only reports how far the run read, to a host that
|
|
1891
|
+
* checks the report. It is a list of what is allowed, not of what is withheld: a tool added
|
|
1892
|
+
* later is then not offered until it is named.
|
|
1539
1893
|
*/
|
|
1540
1894
|
declare function syncRunTools(): string[];
|
|
1895
|
+
/** What a run reports about how far it read; the host decides what it counts for. */
|
|
1896
|
+
interface ISyncProgressReport {
|
|
1897
|
+
readonly connector: string;
|
|
1898
|
+
/** The receipt time of the last item the run fully handled. */
|
|
1899
|
+
readonly through?: string;
|
|
1900
|
+
/** Whether the run reached the end of what the service had from its start point on. */
|
|
1901
|
+
readonly complete: boolean;
|
|
1902
|
+
}
|
|
1903
|
+
type TSyncProgressAnswer = {
|
|
1904
|
+
readonly recorded: true;
|
|
1905
|
+
} | {
|
|
1906
|
+
readonly recorded: false;
|
|
1907
|
+
readonly reason: string;
|
|
1908
|
+
};
|
|
1909
|
+
/** Where a run's report goes: the host checks it and keeps it. */
|
|
1910
|
+
interface ISyncProgressPort {
|
|
1911
|
+
record(report: ISyncProgressReport): Promise<TSyncProgressAnswer>;
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* The tool a sync run ends with to say how far it read. It changes nothing at the service and nothing the
|
|
1915
|
+
* person said: it hands the report to a port the host supplies, which checks it against the run and decides
|
|
1916
|
+
* whether the next run starts later. Reading less than the limit allowed is not a reason to say complete.
|
|
1917
|
+
*/
|
|
1918
|
+
declare function createSyncProgressTool(port: ISyncProgressPort): FunctionTool;
|
|
1541
1919
|
/** What a sync run is asked, as the goal's own text: short, and shown to the person with the goal. */
|
|
1542
1920
|
declare function syncGoalPrompt(connector: IConnector): string;
|
|
1543
1921
|
/**
|
|
@@ -1560,7 +1938,11 @@ interface IConnectorSyncStatus {
|
|
|
1560
1938
|
declare class ConnectorSync {
|
|
1561
1939
|
private readonly goals;
|
|
1562
1940
|
private readonly halt?;
|
|
1563
|
-
|
|
1941
|
+
/** Runs when a connector's sync is turned off, whether or not it was on: what a host kept for it goes too. */
|
|
1942
|
+
private readonly afterDisable?;
|
|
1943
|
+
constructor(goals: GoalBook, halt?: ((goalId: string) => Promise<void>) | undefined,
|
|
1944
|
+
/** Runs when a connector's sync is turned off, whether or not it was on: what a host kept for it goes too. */
|
|
1945
|
+
afterDisable?: ((connectorId: string) => void | Promise<void>) | undefined);
|
|
1564
1946
|
private goalOf;
|
|
1565
1947
|
status(connectorId: string): Promise<IConnectorSyncStatus | undefined>;
|
|
1566
1948
|
/** Turn sync on, or change how often it runs; a new sync is due at once, a changed one keeps its place. */
|
|
@@ -1569,5 +1951,5 @@ declare class ConnectorSync {
|
|
|
1569
1951
|
disable(connectorId: string): Promise<boolean>;
|
|
1570
1952
|
}
|
|
1571
1953
|
//#endregion
|
|
1572
|
-
export { ATTENTION_MAX_CHARACTERS, BROWSER_INSTRUCTIONS, BROWSER_LISTENING_MS, BROWSER_OUTBOX_CAPACITY, BROWSER_TOOL_NAMES, BrowserNavigationRefusedError, BrowserOutbox, BrowserUnavailableError, CASE_INSTRUCTIONS, CASE_TOOL_NAMES, CASE_URGENCIES, CONNECTOR_AUTHS, CONNECTOR_INSTRUCTIONS, CONNECTOR_KINDS, CONNECTOR_TOOL_NAMES, CaseBook, CaseRefusedError, ConnectorBook, ConnectorRefusedError, ConnectorRegistry, ConnectorSync, DAILY_LIMIT_MAX, DEFAULT_DELIVERY_SETTINGS, DeliveryRefusedError, GOAL_INSTRUCTIONS, GOAL_TOOL_NAMES, GoalBook, GoalRefusedError, type IAnswerInput, type IAskInput, type IBrowserActionResult, type IBrowserMark, type IBrowserNotification, type IBrowserOutboxOptions, type IBrowserPort, type IBrowserSnapshot, type IBrowserView, type ICase, type ICaseAskedEvent, type ICaseBookOptions, type ICaseEvent, type ICaseNote, type ICaseOrigin, type ICaseQuestion, type ICaseStore, type IChannelAdapter, type IChannelApprovalAnswer, type IChannelApprovalRequest, type IChannelBinding, type IChannelCapabilities, type IChannelHandler, type IChannelHub, type IChannelHubOptions, type IChannelMessage, type IClaim, type IClaimSource, type IConnector, type IConnectorCallResult, type IConnectorCatalogEntry, type IConnectorProtocol, type IConnectorRegistryOptions, type IConnectorStatus, type IConnectorStore, type IConnectorSyncStatus, type IConnectorToolHints, type IConnectorToolInfo, type IConnectorToolView, type IConnectorView, type ICreateConnectorInput, type ICreateGoalInput, IDEA_INSTRUCTIONS, IDEA_TOOL_NAMES, type IDecideDeliveryInput, type IDeliveryFeed, type IDeliveryMessage, type IDeliverySettings, type IDeliverySink, type IDeliveryState, type IDeliveryStatus, type IDeliveryStore, type IDigestSchedule, type IDisconnectOutcome, type IFeedItem, type IFeedQuestion, type IFixtureChannel, type IGoal, type IGoalAction, type IGoalBookOptions, type IGoalRun, type IGoalStore, type IHeldSubmission, type IIdea, type IIdeaBookOptions, type IIdeaStore, type IKnowledgeStore, type IKnowledgeWikiOptions, type ILintReport, type INotificationAddressOptions, type INotificationAddressView, type IOpenCaseInput, type IQuestionAnswer, type IQuestionDeliveryOptions, type IQuietHours, type IRememberInput, type IRememberResult, type ISearchHit, type ISignInContext, type ISpace, type ISpacePage, type ISpaceStore, type IWebhookRequest, type IWebhookStore, type IWebhookTarget, type IWebhookTransport, type IWikiLogEntry, type IWikiPage, IdeaBook, IdeaRefusedError, KnowledgeWiki, NotificationAddress, PAGE_KINDS, QuestionDelivery, SYNC_MAX_MINUTES, SYNC_MIN_MINUTES, SensitiveContentRefusedError, SpaceBook, SpaceRefusedError, type TApprovalState, type TCaseEventKind, type TCaseState, type TCaseUrgency, type TChannelApprovalAnswer, type TChannelTurn, type TClaimOrigin, type TConnectorAuth, type TConnectorKind, type TConnectorState, type TDelivery, type TFeedKind, type TGoalRunOutcome, type TGoalStatus, type TIdeaOrigin, type TIdeaStatus, type TPageKind, type TQuestionState, type TRevocation, type TToolAccess, type TToolDecision, type TWebhookAnswer, type TWebhookFormat, type TWikiLogAction, WEBHOOK_FORMATS, WIKI_INSTRUCTIONS, WIKI_TOOL_NAMES, caseTurnInstructions, caseTurnPrompt, caseTurnTools, catalogEntriesFromRegistry, catalogEntryOf, classifyTool, connectorReference, countPulled, createBrowserTools, createCaseTools, createChannelHub, createConnectorKeepTool, createConnectorTools, createFileCaseStore, createFileConnectorStore, createFileDeliveryStores, createFileGoalStore, createFileIdeaStore, createFileKnowledgeStore, createFileSpaceStore, createFileWebhookStore, createFixtureChannel, createGoalTools, createIdeaTools, createMemoryCaseStore, createMemoryConnectorStore, createMemoryDeliveryStore, createMemoryGoalStore, createMemoryIdeaStore, createMemoryKnowledgeStore, createMemorySpaceStore, createMemoryWebhookStore, createWikiTools, decideDelivery, defaultAttention, effectiveAttention, forgetPulled, goalRunInstructions, originOfConnector, pageIdFor, parseNotificationAddress, renderGoal, renderPageForModel, renderPageMarkdown, renderView, splitForChannel, syncGoalPrompt, syncRunInstructions, syncRunTools, webhookMessage };
|
|
1954
|
+
export { ATTENTION_MAX_CHARACTERS, BROWSER_INSTRUCTIONS, BROWSER_LISTENING_MS, BROWSER_OUTBOX_CAPACITY, BROWSER_TOOL_NAMES, BrowserNavigationRefusedError, BrowserOutbox, BrowserUnavailableError, CASE_INSTRUCTIONS, CASE_TOOL_NAMES, CASE_URGENCIES, CONNECTOR_AUTHS, CONNECTOR_INSTRUCTIONS, CONNECTOR_KINDS, CONNECTOR_TOOL_NAMES, CaseBook, CaseRefusedError, ConnectorBook, ConnectorRefusedError, ConnectorRegistry, ConnectorSync, DAILY_LIMIT_MAX, DEFAULT_DELIVERY_SETTINGS, DeliveryRefusedError, FORGOTTEN_MARKER, GOAL_INSTRUCTIONS, GOAL_TOOL_NAMES, GoalBook, GoalRefusedError, type IAnswerInput, type IAskInput, type IBrowserActionResult, type IBrowserMark, type IBrowserNotification, type IBrowserOutboxOptions, type IBrowserPort, type IBrowserSnapshot, type IBrowserView, type ICase, type ICaseAnswerEvent, type ICaseAskedEvent, type ICaseBookOptions, type ICaseEvent, type ICaseNote, type ICaseOrigin, type ICaseQuestion, type ICaseStore, type IChannelAdapter, type IChannelApprovalAnswer, type IChannelApprovalRequest, type IChannelBinding, type IChannelCapabilities, type IChannelHandler, type IChannelHub, type IChannelHubOptions, type IChannelMessage, type IClaim, type IClaimSource, type IConnector, type IConnectorCallResult, type IConnectorCatalogEntry, type IConnectorDispatchRequest, type IConnectorProtocol, type IConnectorRegistryOptions, type IConnectorStatus, type IConnectorStore, type IConnectorSyncStatus, type IConnectorToolHints, type IConnectorToolInfo, type IConnectorToolView, type IConnectorView, type ICreateConnectorInput, type ICreateGoalInput, IDEA_INSTRUCTIONS, IDEA_TOOL_NAMES, type IDecideDeliveryInput, type IDeliveryFeed, type IDeliveryMessage, type IDeliverySettings, type IDeliverySink, type IDeliveryState, type IDeliveryStatus, type IDeliveryStore, type IDigestSchedule, type IDisconnectOutcome, type IFeedItem, type IFeedQuestion, type IFixtureChannel, type IForgetReach, type IForgetReachReport, type IForgetResult, type IForgottenText, type IGoal, type IGoalAction, type IGoalBookOptions, type IGoalRun, type IGoalStore, type IHeldSubmission, type IIdea, type IIdeaBookOptions, type IIdeaStore, type IKnowledgeStore, type IKnowledgeWikiOptions, type ILintReport, type INotificationAddressOptions, type INotificationAddressView, type IOfferCandidate, type IOfferDeliveryInput, type IOfferProposer, type IOfferSourceRef, type IOpenCaseInput, type IPendingOffer, type IQuestionAnswer, type IQuestionDeliveryOptions, type IQuietHours, type IRememberInput, type IRememberResult, type IReplaceTokenHooks, type IReplaceTokenOutcome, type ISearchHit, type ISignInContext, type ISpace, type ISpacePage, type ISpaceStore, type ISyncProgressPort, type ISyncProgressReport, type IWebhookRequest, type IWebhookStore, type IWebhookTarget, type IWebhookTransport, type IWikiLogEntry, type IWikiPage, IdeaBook, IdeaRefusedError, KnowledgeWiki, NotificationAddress, OFFER_SOURCE_COOLDOWN_MS, OFFER_TOOL_NAMES, PAGE_KINDS, QuestionDelivery, SYNC_MAX_MINUTES, SYNC_MIN_MINUTES, SensitiveContentRefusedError, SpaceBook, SpaceRefusedError, type TApprovalState, type TCaseEventKind, type TCaseState, type TCaseUrgency, type TChannelApprovalAnswer, type TChannelTurn, type TClaimOrigin, type TConnectorAuth, type TConnectorDispatchAdmission, type TConnectorKind, type TConnectorState, type TDelivery, type TFeedKind, type TForgetTarget, type TGoalRunOutcome, type TGoalStatus, type TIdeaOrigin, type TIdeaStatus, type TOfferProposal, type TPageKind, type TQuestionState, type TRevocation, type TSyncProgressAnswer, type TToolAccess, type TToolDecision, type TWebhookAnswer, type TWebhookFormat, type TWikiLogAction, WEBHOOK_FORMATS, WIKI_INSTRUCTIONS, WIKI_TOOL_NAMES, carriesSecretValue, caseTurnInstructions, caseTurnPrompt, caseTurnTools, catalogEntriesFromRegistry, catalogEntryOf, classifyTool, connectorReference, countPulled, createBrowserTools, createCaseTools, createChannelHub, createConnectorKeepTool, createConnectorTools, createFileCaseStore, createFileConnectorStore, createFileDeliveryStores, createFileGoalStore, createFileIdeaStore, createFileKnowledgeStore, createFileSpaceStore, createFileWebhookStore, createFixtureChannel, createForgottenTextRedactor, createGoalTools, createIdeaTools, createMemoryCaseStore, createMemoryConnectorStore, createMemoryDeliveryStore, createMemoryGoalStore, createMemoryIdeaStore, createMemoryKnowledgeStore, createMemorySpaceStore, createMemoryWebhookStore, createOfferTools, createSyncProgressTool, createWikiTools, decideDelivery, defaultAttention, effectiveAttention, forgetPulled, goalRunInstructions, isSpecificText, originOfConnector, pageIdFor, parseConnectorArguments, parseNotificationAddress, renderGoal, renderPageForModel, renderPageMarkdown, renderView, splitForChannel, syncGoalPrompt, syncRunInstructions, syncRunTools, webhookMessage };
|
|
1573
1955
|
//# sourceMappingURL=index.d.cts.map
|