@songsid/agend 2.3.4-beta.8 → 2.3.4-beta.9
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/THIRD_PARTY_NOTICES.md +37 -0
- package/dist/agent-cli-instructions.md +1 -1
- package/dist/agent-credentials.d.ts +24 -0
- package/dist/agent-credentials.js +66 -0
- package/dist/agent-credentials.js.map +1 -0
- package/dist/agent-endpoint.d.ts +3 -1
- package/dist/agent-endpoint.js +13 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/authority/session-authorizations.d.ts +28 -4
- package/dist/authority/session-authorizations.js +63 -17
- package/dist/authority/session-authorizations.js.map +1 -1
- package/dist/backend/antigravity.js +3 -1
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/codex-footer-hints.d.ts +4 -0
- package/dist/backend/codex-footer-hints.js +27 -0
- package/dist/backend/codex-footer-hints.js.map +1 -0
- package/dist/backend/codex.js +8 -3
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/muse.js +5 -3
- package/dist/backend/muse.js.map +1 -1
- package/dist/cache-ledger.d.ts +85 -0
- package/dist/cache-ledger.js +236 -1
- package/dist/cache-ledger.js.map +1 -1
- package/dist/cache-service.d.ts +5 -0
- package/dist/cache-service.js +16 -4
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/adapters/discord.js +11 -3
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.js +4 -3
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/mcp-tools.js +1 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/cross-instance-notice.d.ts +10 -0
- package/dist/cross-instance-notice.js +67 -5
- package/dist/cross-instance-notice.js.map +1 -1
- package/dist/daemon.d.ts +3 -0
- package/dist/daemon.js +11 -4
- package/dist/daemon.js.map +1 -1
- package/dist/export-import.d.ts +7 -0
- package/dist/export-import.js +44 -10
- package/dist/export-import.js.map +1 -1
- package/dist/fleet-context.d.ts +2 -0
- package/dist/fleet-manager.d.ts +82 -4
- package/dist/fleet-manager.js +361 -29
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +1 -0
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -1
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
- package/dist/instance-lifecycle.d.ts +6 -2
- package/dist/instance-lifecycle.js +11 -6
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instance-topic-delete.d.ts +77 -0
- package/dist/instance-topic-delete.js +123 -0
- package/dist/instance-topic-delete.js.map +1 -0
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +1 -1
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +23 -1
- package/dist/locale.js.map +1 -1
- package/dist/log-steps.d.ts +4 -3
- package/dist/log-steps.js +32 -7
- package/dist/log-steps.js.map +1 -1
- package/dist/outbound-handlers.js +3 -3
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.js +5 -2
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/scheduler/db.d.ts +2 -1
- package/dist/scheduler/db.js +23 -9
- package/dist/scheduler/db.js.map +1 -1
- package/dist/settings-api.d.ts +13 -0
- package/dist/settings-api.js +12 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/tool-progress.d.ts +2 -0
- package/dist/tool-progress.js +19 -3
- package/dist/tool-progress.js.map +1 -1
- package/dist/topic-commands.js +4 -0
- package/dist/topic-commands.js.map +1 -1
- package/dist/ui/chat-strings.js +2 -2
- package/dist/ui/fleet-usage.js +90 -27
- package/dist/ui/panel-chat.js +2 -0
- package/dist/ui/settings-strings.js +2 -2
- package/dist/ui/shared/app.css +15 -0
- package/dist/ui/shared/usage-dialog.js +18 -1
- package/dist/ui/shared/view-strings.js +16 -0
- package/dist/usage/capacity.d.ts +69 -0
- package/dist/usage/capacity.js +119 -0
- package/dist/usage/capacity.js.map +1 -0
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +3 -0
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/profile-timeline.d.ts +16 -0
- package/dist/usage/profile-timeline.js +58 -0
- package/dist/usage/profile-timeline.js.map +1 -0
- package/dist/usage/quota-history.d.ts +43 -0
- package/dist/usage/quota-history.js +168 -0
- package/dist/usage/quota-history.js.map +1 -0
- package/dist/usage/usage-api.d.ts +31 -0
- package/dist/usage/usage-api.js +80 -1
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/usage-report.d.ts +25 -1
- package/dist/usage-report.js +55 -4
- package/dist/usage-report.js.map +1 -1
- package/dist/usage-rollup.d.ts +4 -1
- package/dist/usage-rollup.js +12 -3
- package/dist/usage-rollup.js.map +1 -1
- package/dist/web-api.d.ts +6 -0
- package/dist/web-api.js +8 -2
- package/dist/web-api.js.map +1 -1
- package/dist/web-session-authorization.d.ts +13 -2
- package/dist/web-session-authorization.js +10 -3
- package/dist/web-session-authorization.js.map +1 -1
- package/package.json +1 -1
package/dist/export-import.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The archive file, private from its first byte: created here, exclusively, 0600 (the umask can only narrow it), and
|
|
3
|
+
* never through a link. The archive holds the fleet's secrets (.env), so it must never exist readable by others, not
|
|
4
|
+
* even for the moment a chmod afterwards would leave. An existing destination — a file, a directory or a symlink — is
|
|
5
|
+
* refused, never replaced or followed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function openPrivateArchive(path: string): number;
|
|
1
8
|
export declare function exportConfig(dataDir: string, outputPath: string | undefined, full: boolean): Promise<void>;
|
|
2
9
|
export declare function importConfig(dataDir: string, filePath: string): Promise<void>;
|
package/dist/export-import.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureAgendHome } from "./agend-home.js";
|
|
2
2
|
import { execFileSync } from "node:child_process";
|
|
3
3
|
import { t } from "./locale.js";
|
|
4
|
-
import { existsSync, statSync, copyFileSync, readFileSync, } from "node:fs";
|
|
4
|
+
import { existsSync, statSync, copyFileSync, readFileSync, openSync, closeSync, fsyncSync, unlinkSync, constants as fsConstants, } from "node:fs";
|
|
5
5
|
import { join, basename, resolve, sep as pathSep } from "node:path";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
7
|
const MINIMAL_FILES = ["fleet.yaml", ".env", "scheduler.db", "classicBot.yaml"];
|
|
@@ -13,6 +13,43 @@ const RUNTIME_EXCLUDES = [
|
|
|
13
13
|
"fleet.log",
|
|
14
14
|
"node_modules",
|
|
15
15
|
];
|
|
16
|
+
/**
|
|
17
|
+
* The archive file, private from its first byte: created here, exclusively, 0600 (the umask can only narrow it), and
|
|
18
|
+
* never through a link. The archive holds the fleet's secrets (.env), so it must never exist readable by others, not
|
|
19
|
+
* even for the moment a chmod afterwards would leave. An existing destination — a file, a directory or a symlink — is
|
|
20
|
+
* refused, never replaced or followed.
|
|
21
|
+
*/
|
|
22
|
+
export function openPrivateArchive(path) {
|
|
23
|
+
// O_CREAT | O_EXCL fails on any existing path — a symlink included, which it never follows (POSIX open(2)).
|
|
24
|
+
const flags = fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL;
|
|
25
|
+
try {
|
|
26
|
+
return openSync(path, flags, 0o600);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
if (err.code === "EEXIST") {
|
|
30
|
+
console.error(`${path} already exists. Choose another output path, or move that file away first.`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** tar into the private archive (its stdout is the archive's fd); on failure the partial archive is removed. */
|
|
37
|
+
function tarInto(outFile, args) {
|
|
38
|
+
const fd = openPrivateArchive(outFile);
|
|
39
|
+
try {
|
|
40
|
+
execFileSync("tar", ["czf", "-", ...args], { stdio: ["ignore", fd, "pipe"] });
|
|
41
|
+
fsyncSync(fd);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
closeSync(fd);
|
|
45
|
+
try {
|
|
46
|
+
unlinkSync(outFile);
|
|
47
|
+
}
|
|
48
|
+
catch { /* already gone */ }
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
closeSync(fd);
|
|
52
|
+
}
|
|
16
53
|
// Reject tarballs above this size to blunt zip-bomb style exhaustion.
|
|
17
54
|
const MAX_IMPORT_BYTES = 500 * 1024 * 1024;
|
|
18
55
|
export async function exportConfig(dataDir, outputPath, full) {
|
|
@@ -20,14 +57,13 @@ export async function exportConfig(dataDir, outputPath, full) {
|
|
|
20
57
|
console.error(`Data directory not found: ${dataDir}`);
|
|
21
58
|
process.exit(1);
|
|
22
59
|
}
|
|
23
|
-
|
|
24
|
-
|
|
60
|
+
// The default name carries the time to the second (UTC), so a second export on the same day gets its own file
|
|
61
|
+
// instead of meeting an existing one (which openPrivateArchive refuses). An explicit path is used as given.
|
|
62
|
+
const stamp = new Date().toISOString().slice(0, 19).replace(/[-:]/g, "").replace("T", "-");
|
|
63
|
+
const outFile = resolve(outputPath ?? `agend-export-${stamp}.tar.gz`);
|
|
25
64
|
if (full) {
|
|
26
65
|
const excludeArgs = RUNTIME_EXCLUDES.flatMap((p) => ["--exclude", p]);
|
|
27
|
-
|
|
28
|
-
"czf", outFile, ...excludeArgs,
|
|
29
|
-
"-C", join(dataDir, ".."), basename(dataDir),
|
|
30
|
-
], { stdio: "pipe" });
|
|
66
|
+
tarInto(outFile, [...excludeArgs, "-C", join(dataDir, ".."), basename(dataDir)]);
|
|
31
67
|
}
|
|
32
68
|
else {
|
|
33
69
|
// Minimal: only config files that exist
|
|
@@ -37,9 +73,7 @@ export async function exportConfig(dataDir, outputPath, full) {
|
|
|
37
73
|
process.exit(1);
|
|
38
74
|
}
|
|
39
75
|
const fileArgs = existing.map((f) => `${basename(dataDir)}/${f}`);
|
|
40
|
-
|
|
41
|
-
"czf", outFile, "-C", join(dataDir, ".."), ...fileArgs,
|
|
42
|
-
], { stdio: "pipe" });
|
|
76
|
+
tarInto(outFile, ["-C", join(dataDir, ".."), ...fileArgs]);
|
|
43
77
|
}
|
|
44
78
|
const size = statSync(outFile).size;
|
|
45
79
|
const sizeStr = size < 1024
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-import.js","sourceRoot":"","sources":["../src/export-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EAEZ,YAAY,
|
|
1
|
+
{"version":3,"file":"export-import.js","sourceRoot":"","sources":["../src/export-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EAEZ,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,IAAI,WAAW,GACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,aAAa,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAChF,MAAM,gBAAgB,GAAG;IACvB,QAAQ;IACR,OAAO;IACP,OAAO;IACP,YAAY;IACZ,WAAW;IACX,cAAc;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;I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C;QACH,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;YAC/C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;gBACxB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC5B,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/fleet-context.d.ts
CHANGED
|
@@ -120,6 +120,8 @@ export interface FleetContext {
|
|
|
120
120
|
saveFleetConfig(): void;
|
|
121
121
|
getInstanceDir(name: string): string;
|
|
122
122
|
createForumTopic(topicName: string, adapterId?: string): Promise<number | string>;
|
|
123
|
+
/** #3055: a topic with this id is being deleted right now (its agent was deleted); binding it waits until it is over. */
|
|
124
|
+
isTopicDeletionInFlight?(topicId: number | string): boolean;
|
|
123
125
|
removeInstance(name: string, authorization: ExplicitInstanceRemoval): Promise<void>;
|
|
124
126
|
/** Quarantine a provider-confirmed missing topic without deleting user data. */
|
|
125
127
|
quarantineMissingTopic(threadId: string, target: RouteTarget, evidence: {
|
package/dist/fleet-manager.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { FleetConfig, RawFleetConfig, InstanceConfig, WebVerifiedAuthorityC
|
|
|
15
15
|
import { type DeliveryStatus, type GuildEmoji, type GuildEmojiGroup, type ResolvedStatusEmojis } from "./status-emojis.js";
|
|
16
16
|
import { type RouteTarget } from "./fleet-context.js";
|
|
17
17
|
import { EventLog } from "./event-log.js";
|
|
18
|
+
import { type TopicDeleteOutcome } from "./instance-topic-delete.js";
|
|
18
19
|
import { BackendAvailabilityStore, type AvailabilityProbes, type BackendAvailability } from "./backend-availability.js";
|
|
19
20
|
import { AdapterWorld } from "./adapter-world.js";
|
|
20
21
|
import { CostGuard } from "./cost-guard.js";
|
|
@@ -87,6 +88,7 @@ import { WebBackendLogins, type SignInTarget } from "./web-backend-login.js";
|
|
|
87
88
|
import { BrowserBackendSignIns } from "./browser-backend-signins.js";
|
|
88
89
|
import { type RawConfigPatch } from "./settings-api.js";
|
|
89
90
|
import { type AgentEndpointContext } from "./agent-endpoint.js";
|
|
91
|
+
import { AgentCredentials } from "./agent-credentials.js";
|
|
90
92
|
import { ClassicChannelManager } from "./classic-channel-manager.js";
|
|
91
93
|
import { type ExplicitInstanceRemoval } from "./instance-removal.js";
|
|
92
94
|
import { type SessionOomRetry } from "./session-oom-stop.js";
|
|
@@ -584,6 +586,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
584
586
|
private discordPresenceEagerPending;
|
|
585
587
|
private discordPresenceInFlight;
|
|
586
588
|
private static readonly DISCORD_PRESENCE_REFRESH_MS;
|
|
589
|
+
/** #3066 §1d: how often a fleet with no Discord bot reads the quota for its history (the user's choice: 30 min). */
|
|
590
|
+
static readonly QUOTA_BACKGROUND_READ_MS: number;
|
|
591
|
+
private quotaReadTimer;
|
|
587
592
|
/** Days of event/activity history to keep. */
|
|
588
593
|
private static readonly EVENT_LOG_RETENTION_DAYS;
|
|
589
594
|
private watchdogTimer;
|
|
@@ -884,6 +889,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
884
889
|
* startup-only key at startup. See checkStartupSignatureConsistency(). */
|
|
885
890
|
private fleetSignatureMismatch;
|
|
886
891
|
private healthServerListening;
|
|
892
|
+
private agentCredentialsCache?;
|
|
893
|
+
get agentCredentials(): AgentCredentials;
|
|
887
894
|
constructor(dataDir: string);
|
|
888
895
|
/** #1266: a reply's buttons — the store (reply-buttons.db) and what a click does. Created on first use. */
|
|
889
896
|
private replyButtonsCtl;
|
|
@@ -2046,6 +2053,35 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
2046
2053
|
/** Start all instances from fleet config */
|
|
2047
2054
|
startAll(configPath: string): Promise<void>;
|
|
2048
2055
|
private startAllWithinDeadline;
|
|
2056
|
+
/**
|
|
2057
|
+
* #3066 §1d (the user: yes, every 30 min): the quota history (usage/quota-history.ts) records only the readings AgEnD
|
|
2058
|
+
* makes. A Discord bot's presence refresh reads every 15 min; without one, nothing reads while nobody looks. So, with no
|
|
2059
|
+
* Discord bot and while some account has a running agent, read every 30 min — the same cached read (its 5-minute TTL
|
|
2060
|
+
* still bounds the vendor calls), recorded like any other.
|
|
2061
|
+
*/
|
|
2062
|
+
private startQuotaBackgroundReads;
|
|
2063
|
+
/** #3066 §1: the latest estimates, by `provider\0metric` (what usage-api's lookup reads, synchronously). */
|
|
2064
|
+
private capacityEstimates;
|
|
2065
|
+
private capacityTimer;
|
|
2066
|
+
static readonly CAPACITY_REFRESH_MS: number;
|
|
2067
|
+
/**
|
|
2068
|
+
* #3066 §1: estimate each account's weekly 100% from the quota history (§1d) and the usage ledger's hours — both read
|
|
2069
|
+
* asynchronously, the arithmetic small (usage/capacity.ts). An account is its usage provider id ("claude",
|
|
2070
|
+
* "claude:hsinlin", "codex:yanxianchen"): its hours are the ledger sources of that backend under that credential profile
|
|
2071
|
+
* (Codex's "unrecorded" hours are no account's). A per-model weekly ("Sonnet (weekly)") counts only that model's tokens.
|
|
2072
|
+
*
|
|
2073
|
+
* Prism #3073: no estimate rather than a wrong one —
|
|
2074
|
+
* - a window is measured only where the ledger has its hours: kept (31 days) and scanned (`days.coverage`) for every
|
|
2075
|
+
* instance of the account's backend, and every instance whose hours count for it; the quota history goes back 12 weeks;
|
|
2076
|
+
* - a profile literally named "default", "unknown" or "unrecorded" (configured, on disk, or in the quota history) makes
|
|
2077
|
+
* those hours ambiguous: neither the host
|
|
2078
|
+
* account nor the named one is estimated (each would be credited the other's use, or lose its own);
|
|
2079
|
+
* - only a metric the vendor marks per-model (`scope: "model"`) is filtered by model; another named weekly pool
|
|
2080
|
+
* ("Luna Reserve (weekly)", Antigravity pools) is no model name and is not estimated.
|
|
2081
|
+
*/
|
|
2082
|
+
refreshCapacity(): Promise<number>;
|
|
2083
|
+
/** One background quota read, when nothing else reads (no Discord bot) and an account has a running agent. */
|
|
2084
|
+
backgroundQuotaRead(): Promise<boolean>;
|
|
2049
2085
|
/** Keep Discord profile activity aligned with the same cached usage source as /usage. */
|
|
2050
2086
|
private startDiscordUsagePresence;
|
|
2051
2087
|
/**
|
|
@@ -2428,6 +2464,12 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
2428
2464
|
* of the schedule response on IPC.
|
|
2429
2465
|
*/
|
|
2430
2466
|
private performScheduleOp;
|
|
2467
|
+
/**
|
|
2468
|
+
* `post_decision` with `supersedes` changes a decision someone else may have recorded (it stops being active): the
|
|
2469
|
+
* same permission as `update_decision`, asked through the same live check (tool set + dashboard switches), on both
|
|
2470
|
+
* create paths. An empty or absent value supersedes nothing and needs nothing; anything else must be an id.
|
|
2471
|
+
*/
|
|
2472
|
+
private decisionSupersedes;
|
|
2431
2473
|
handleDecisionCrudHttp(instance: string, op: string, args: Record<string, unknown>): Promise<unknown>;
|
|
2432
2474
|
handleTaskCrudHttp(instance: string, args: Record<string, unknown>): Promise<unknown>;
|
|
2433
2475
|
handleSetDisplayNameHttp(instance: string, name: string): Promise<unknown>;
|
|
@@ -2443,7 +2485,41 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
2443
2485
|
private handleTaskCrud;
|
|
2444
2486
|
/** Create a forum topic via the adapter. Returns the message_thread_id. */
|
|
2445
2487
|
createForumTopic(topicName: string, adapterId?: string): Promise<number | string>;
|
|
2446
|
-
|
|
2488
|
+
/**
|
|
2489
|
+
* Delete an agent and, unless asked not to, its own chat topic (user decision: by default). The topic is planned
|
|
2490
|
+
* before the removal (its id and bot go with the fleet.yaml entry) and deleted through the agent's OWN bot after it;
|
|
2491
|
+
* the outcome is the platform's answer (instance-topic-delete.ts). A topic that cannot go never fails the removal.
|
|
2492
|
+
*/
|
|
2493
|
+
removeInstanceAndTopic(name: string, authorization: ExplicitInstanceRemoval, opts: {
|
|
2494
|
+
deleteTopic: boolean;
|
|
2495
|
+
execution?: SettingsExecution;
|
|
2496
|
+
}): Promise<TopicDeleteOutcome>;
|
|
2497
|
+
/** #3055: destinations whose platform deletion is running now; a binding to one waits until it is over. */
|
|
2498
|
+
private readonly topicDeletionsInFlight;
|
|
2499
|
+
/** True while a topic with this id is being deleted on any connection (a new binding of it is refused meanwhile). */
|
|
2500
|
+
isTopicDeletionInFlight(topicId: number | string): boolean;
|
|
2501
|
+
/**
|
|
2502
|
+
* #3055 review r2 (Prism P1-3): would this instance config bind a topic whose deletion is running now? Compared by
|
|
2503
|
+
* physical destination, so the same thread number in another Telegram group is not held. Settings asks it at commit.
|
|
2504
|
+
*/
|
|
2505
|
+
topicBindingInFlight(inst: {
|
|
2506
|
+
channel_id?: unknown;
|
|
2507
|
+
topic_id?: unknown;
|
|
2508
|
+
}): boolean;
|
|
2509
|
+
/** Any topic deletion running now (a connection's group or General may not be re-pointed meanwhile). */
|
|
2510
|
+
topicDeletionPending(): boolean;
|
|
2511
|
+
/** The physical destination of `topicId` on the bot `adapterId`. */
|
|
2512
|
+
private destinationFor;
|
|
2513
|
+
/** The adapter of the bot `adapterId` names — never a substitute for a bot that is not there. */
|
|
2514
|
+
private instanceTopicAdapter;
|
|
2515
|
+
/**
|
|
2516
|
+
* Topic ownership by physical destination (#3055 review, Prism P1): an instance's topic is where its bot's platform
|
|
2517
|
+
* puts it (a Telegram group + thread, a Discord channel), so two bots in one group, or two instances on one
|
|
2518
|
+
* channel, are seen to share it; and every connection's own General is protected, with or without a General agent.
|
|
2519
|
+
*/
|
|
2520
|
+
private topicOwnership;
|
|
2521
|
+
/** What deleting `name`'s topic would act on: its own bot only — a bot that is not there is never substituted. */
|
|
2522
|
+
private planInstanceTopicDelete;
|
|
2447
2523
|
getForumTopicDeleter(adapterId?: string): ((topicId: number | string) => Promise<void>) | null;
|
|
2448
2524
|
private topicCleanupTimer;
|
|
2449
2525
|
private sessionPruneTimer;
|
|
@@ -3429,9 +3505,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
3429
3505
|
* Make a tool summary safe to paste into a channel message.
|
|
3430
3506
|
*
|
|
3431
3507
|
* The text is agent-controlled (it is built from tool inputs — file paths,
|
|
3432
|
-
* shell commands), so it gets flattened to one line, capped,
|
|
3433
|
-
* the two Discord mass-mention triggers.
|
|
3434
|
-
*
|
|
3508
|
+
* shell commands), so it gets flattened to one line, secrets masked, capped,
|
|
3509
|
+
* and stripped of the two Discord mass-mention triggers. Masking comes BEFORE
|
|
3510
|
+
* the cap: a cap can cut a mask's context but must never be what hides (or
|
|
3511
|
+
* fails to hide) a secret. Neither channel renders it with a parse mode, so no
|
|
3512
|
+
* markup escaping is needed beyond that.
|
|
3435
3513
|
*/
|
|
3436
3514
|
private static sanitizeActivity;
|
|
3437
3515
|
/**
|