@songsid/agend 2.3.5-beta.1 → 2.3.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-cli-instructions.md +1 -1
- package/dist/agent-cli.js +5 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-whats-new.js +4 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.d.ts +1 -1
- package/dist/auth-api.js +1 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.d.ts +1 -0
- package/dist/backend/claude-code.js +56 -10
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/kiro.js +1 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/types.d.ts +4 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/channel/access-manager.d.ts +1 -6
- package/dist/channel/access-manager.js +4 -94
- package/dist/channel/access-manager.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +0 -2
- package/dist/channel/adapters/discord.js +0 -8
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +0 -3
- package/dist/channel/adapters/telegram.js +1 -30
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/mcp-tools.js +2 -2
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/types.d.ts +0 -2
- package/dist/claude-model-minimum.d.ts +7 -0
- package/dist/claude-model-minimum.js +16 -0
- package/dist/claude-model-minimum.js.map +1 -0
- package/dist/cli.js +1 -19
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +2 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.d.ts +43 -1
- package/dist/daemon.js +176 -27
- package/dist/daemon.js.map +1 -1
- package/dist/decision-list.d.ts +2 -0
- package/dist/decision-list.js +1 -1
- package/dist/decision-list.js.map +1 -1
- package/dist/fleet-manager.d.ts +24 -0
- package/dist/fleet-manager.js +98 -21
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +17 -6
- package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
- package/dist/general-knowledge/steering/core-rules.md +6 -4
- package/dist/instance-lifecycle.d.ts +3 -0
- package/dist/instance-lifecycle.js +4 -0
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +44 -34
- package/dist/locale.js.map +1 -1
- package/dist/outbound-handlers.js +1 -1
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +2 -0
- package/dist/outbound-schemas.js +4 -2
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/quickstart-api.js +2 -2
- package/dist/quickstart-api.js.map +1 -1
- package/dist/reply-buttons-controller.d.ts +5 -1
- package/dist/reply-buttons-controller.js +8 -4
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/reply-buttons.d.ts +6 -2
- package/dist/reply-buttons.js +7 -3
- package/dist/reply-buttons.js.map +1 -1
- package/dist/scheduler/db.d.ts +10 -0
- package/dist/scheduler/db.js +38 -11
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/types.d.ts +6 -1
- package/dist/structured-signin.js +3 -1
- package/dist/structured-signin.js.map +1 -1
- package/dist/team-membership.d.ts +7 -0
- package/dist/team-membership.js +10 -0
- package/dist/team-membership.js.map +1 -0
- package/dist/tips.js +4 -4
- package/dist/tips.js.map +1 -1
- package/dist/tmux-manager.d.ts +1 -1
- package/dist/tmux-manager.js +4 -1
- package/dist/tmux-manager.js.map +1 -1
- package/dist/topic-commands.js +1 -1
- package/dist/topic-commands.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/backend-signin.js +1 -1
- package/dist/ui/chat-strings.js +7 -7
- package/dist/ui/settings-dialogs.js +3 -1
- package/dist/ui/settings-quota-notice.js +8 -6
- package/dist/ui/settings-strings.js +6 -4
- package/dist/ui/shared/app-i18n.js +4 -2
- package/dist/ui/shared/app-shell.js +8 -3
- package/dist/ui/shared/setup-host-text.js +4 -1
- package/dist/ui/shared/signin.js +3 -1
- package/dist/ui/shared/view-strings.js +4 -4
- package/dist/ui/shared/web-authorize.js +4 -4
- package/dist/update-dispatch.d.ts +32 -4
- package/dist/update-dispatch.js +146 -16
- package/dist/update-dispatch.js.map +1 -1
- package/dist/update-launch.d.ts +1 -1
- package/dist/update-launch.js +2 -2
- package/dist/update-launch.js.map +1 -1
- package/dist/usage/providers.d.ts +1 -0
- package/dist/usage/providers.js +13 -9
- package/dist/usage/providers.js.map +1 -1
- package/dist/view-api.d.ts +2 -8
- package/dist/view-api.js +3 -9
- package/dist/view-api.js.map +1 -1
- package/package.json +2 -1
package/dist/decision-list.d.ts
CHANGED
package/dist/decision-list.js
CHANGED
|
@@ -21,7 +21,7 @@ export function decisionListAnswer(all, opts = {}) {
|
|
|
21
21
|
if (opts.full === true)
|
|
22
22
|
return all;
|
|
23
23
|
const titles = all.map(d => ({
|
|
24
|
-
id: d.id, title: d.title, scope: d.scope, date: (d.updated_at || d.created_at || "").slice(0, 10),
|
|
24
|
+
id: d.id, title: d.title, scope: d.scope, ...(d.team ? { team: d.team } : {}), date: (d.updated_at || d.created_at || "").slice(0, 10),
|
|
25
25
|
...(d.tags?.length ? { tags: d.tags } : {}),
|
|
26
26
|
...(d.status && d.status !== "active" ? { status: d.status } : {}),
|
|
27
27
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-list.js","sourceRoot":"","sources":["../src/decision-list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decision-list.js","sourceRoot":"","sources":["../src/decision-list.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,oBAAoB,GAAG,6GAA6G,CAAC;AAElJ,sHAAsH;AACtH,SAAS,IAAI,CAAC,GAAwB,EAAE,EAAU;IAChD,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACzC,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAwB,EAAE,IAAI,GAAqC,EAAE;IACtG,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QAClD,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QACpC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,oEAAoE,EAAE,CAAC;IAC7I,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,GAAG,CAAC;IACnC,MAAM,MAAM,GAAoB,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5C,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QACtI,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnE,CAAC,CAAC,CAAC;IACJ,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;AAC3D,CAAC"}
|
package/dist/fleet-manager.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ import { type WebAccount } from "./web-profile.js";
|
|
|
84
84
|
import type { WebPerson as WebPersonView } from "./web-api.js";
|
|
85
85
|
import { ReplyButtonsController } from "./reply-buttons-controller.js";
|
|
86
86
|
import { WebFileLedger } from "./web-upload.js";
|
|
87
|
+
import type { ActiveDecisionRow } from "./daemon.js";
|
|
87
88
|
import { AppearanceTools } from "./web-appearance-tools.js";
|
|
88
89
|
import { ModStore } from "./web-mod-store.js";
|
|
89
90
|
import { type CachedImage } from "./web-images.js";
|
|
@@ -292,6 +293,7 @@ export declare class RestartSupersededError extends Error {
|
|
|
292
293
|
}
|
|
293
294
|
export declare class FleetManager implements FleetContext, LifecycleContext, ArchiverContext, StatuslineWatcherContext, OutboundContext, AgentEndpointContext {
|
|
294
295
|
dataDir: string;
|
|
296
|
+
private decisionSnapshot;
|
|
295
297
|
private static signalTarget;
|
|
296
298
|
private static sighupHandlerInstalled;
|
|
297
299
|
/** Test seam: inject a spy to verify saveFleetConfig calls fsync. Default: fsyncSync. */
|
|
@@ -1584,6 +1586,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
1584
1586
|
* Stopped/paused ClassicBot entries count too; their workspace is exactly
|
|
1585
1587
|
* the one startClassicInstance builds, not this FleetManager's dataDir.
|
|
1586
1588
|
*/
|
|
1589
|
+
/** Take the startup snapshot of every active decision (text cut to 200 characters); see activeDecisions. */
|
|
1590
|
+
snapshotActiveDecisions(): void;
|
|
1591
|
+
/** The startup snapshot of active decisions, for a daemon's Active Decisions (it selects and caps its own). */
|
|
1592
|
+
activeDecisions(): readonly ActiveDecisionRow[];
|
|
1587
1593
|
kiroPeerWorkingDirectories(name: string): string[];
|
|
1588
1594
|
/**
|
|
1589
1595
|
* Probe the same executable set exposed by the web backend catalog.
|
|
@@ -2488,6 +2494,24 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
2488
2494
|
* create paths. An empty or absent value supersedes nothing and needs nothing; anything else must be an id.
|
|
2489
2495
|
*/
|
|
2490
2496
|
private decisionSupersedes;
|
|
2497
|
+
/**
|
|
2498
|
+
* The scope (and team) a new decision gets. Team membership is read from fleet.yaml now. Omitted scope: the poster's
|
|
2499
|
+
* team when they are in exactly one, project (this exact directory) when they are in none; in several, they choose.
|
|
2500
|
+
* A team decision goes only to a team the poster is in.
|
|
2501
|
+
*/
|
|
2502
|
+
decisionScopeFor(instance: string, scope: unknown, team: unknown): {
|
|
2503
|
+
scope: "project" | "team" | "fleet";
|
|
2504
|
+
team?: string;
|
|
2505
|
+
teams: string[];
|
|
2506
|
+
} | {
|
|
2507
|
+
error: string;
|
|
2508
|
+
};
|
|
2509
|
+
/**
|
|
2510
|
+
* #3421 review: a team decision is only for its team's current members — reading it back through an update (even an
|
|
2511
|
+
* empty one) or archiving it is refused to anyone else, exactly as list/get and supersede are. The refusal names it
|
|
2512
|
+
* "not found", as for an id that does not exist, and changes nothing. Project and fleet decisions: as before.
|
|
2513
|
+
*/
|
|
2514
|
+
decisionHiddenFrom(instance: string, id: unknown): string | null;
|
|
2491
2515
|
handleDecisionCrudHttp(instance: string, op: string, args: Record<string, unknown>): Promise<unknown>;
|
|
2492
2516
|
handleTaskCrudHttp(instance: string, args: Record<string, unknown>): Promise<unknown>;
|
|
2493
2517
|
handleSetDisplayNameHttp(instance: string, name: string): Promise<unknown>;
|
package/dist/fleet-manager.js
CHANGED
|
@@ -669,6 +669,7 @@ export class RestartSupersededError extends Error {
|
|
|
669
669
|
}
|
|
670
670
|
export class FleetManager {
|
|
671
671
|
dataDir;
|
|
672
|
+
decisionSnapshot = [];
|
|
672
673
|
static signalTarget = null;
|
|
673
674
|
static sighupHandlerInstalled = false;
|
|
674
675
|
/** Test seam: inject a spy to verify saveFleetConfig calls fsync. Default: fsyncSync. */
|
|
@@ -3601,7 +3602,7 @@ export class FleetManager {
|
|
|
3601
3602
|
}
|
|
3602
3603
|
const origin = `slash /update by ${adapterId}:${data.userId}`;
|
|
3603
3604
|
recordInternalRequest(this.dataDir, "update", origin);
|
|
3604
|
-
const launch = await resolveUpdateLaunch(installed.agend);
|
|
3605
|
+
const launch = await resolveUpdateLaunch(installed.agend, undefined, installed.npmDir);
|
|
3605
3606
|
if (!launch.ok) {
|
|
3606
3607
|
this.failUpdateProgress(`${t("update.failure.shell")} ${t("update.failure.independent", launch.reason)}`);
|
|
3607
3608
|
return;
|
|
@@ -6160,6 +6161,22 @@ export class FleetManager {
|
|
|
6160
6161
|
* Stopped/paused ClassicBot entries count too; their workspace is exactly
|
|
6161
6162
|
* the one startClassicInstance builds, not this FleetManager's dataDir.
|
|
6162
6163
|
*/
|
|
6164
|
+
/** Take the startup snapshot of every active decision (text cut to 200 characters); see activeDecisions. */
|
|
6165
|
+
snapshotActiveDecisions() {
|
|
6166
|
+
try {
|
|
6167
|
+
const decisions = this.scheduler?.db.listAllActiveDecisions() ?? [];
|
|
6168
|
+
this.decisionSnapshot = decisions.map(d => ({ title: d.title, content: (d.content ?? "").slice(0, 200), scope: d.scope, project_root: d.project_root, ...(d.team ? { team: d.team } : {}) }));
|
|
6169
|
+
if (decisions.length > 0)
|
|
6170
|
+
this.logger.info({ count: decisions.length }, "Active decisions snapshotted for instance instructions");
|
|
6171
|
+
}
|
|
6172
|
+
catch (err) {
|
|
6173
|
+
this.logger.debug({ err }, "Decision injection skipped (no decisions db or query failed)");
|
|
6174
|
+
}
|
|
6175
|
+
}
|
|
6176
|
+
/** The startup snapshot of active decisions, for a daemon's Active Decisions (it selects and caps its own). */
|
|
6177
|
+
activeDecisions() {
|
|
6178
|
+
return this.decisionSnapshot;
|
|
6179
|
+
}
|
|
6163
6180
|
kiroPeerWorkingDirectories(name) {
|
|
6164
6181
|
if (!this.fleetConfig || !this.classicChannels)
|
|
6165
6182
|
throw new Error("Kiro peer configuration is not loaded");
|
|
@@ -8538,20 +8555,12 @@ export class FleetManager {
|
|
|
8538
8555
|
this.logger.warn({ err }, "Failed to send daily tip");
|
|
8539
8556
|
}));
|
|
8540
8557
|
this.dailyTipScheduler.start();
|
|
8541
|
-
//
|
|
8542
|
-
//
|
|
8543
|
-
//
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
const capped = decisions.slice(0, 20).map(d => ({ title: d.title, content: (d.content ?? "").slice(0, 200), scope: d.scope, project_root: d.project_root }));
|
|
8548
|
-
process.env.AGEND_DECISIONS = JSON.stringify(capped);
|
|
8549
|
-
this.logger.info({ count: decisions.length, injected: capped.length }, "Injected active decisions into env");
|
|
8550
|
-
}
|
|
8551
|
-
}
|
|
8552
|
-
catch (err) {
|
|
8553
|
-
this.logger.debug({ err }, "Decision injection skipped (no decisions db or query failed)");
|
|
8554
|
-
}
|
|
8558
|
+
// Active decisions for each instance's instructions, snapshotted at startup — new decisions via post_decision are
|
|
8559
|
+
// available through list_decisions but not auto-injected until restart. The whole active set is kept here (each
|
|
8560
|
+
// entry's text cut to 200 characters) and handed to each daemon at spawn (activeDecisions): the daemon selects
|
|
8561
|
+
// its own — fleet, its teams, its directory — and only then applies its caps, so other teams' or directories'
|
|
8562
|
+
// rows can never crowd an instance's own out (#3421 review). Nothing unbounded goes into process.env.
|
|
8563
|
+
this.snapshotActiveDecisions();
|
|
8555
8564
|
}
|
|
8556
8565
|
// Phase 1: Start general instances first and wait for them
|
|
8557
8566
|
const allEntries = Object.entries(fleet.instances);
|
|
@@ -12075,6 +12084,11 @@ export class FleetManager {
|
|
|
12075
12084
|
let result;
|
|
12076
12085
|
switch (msg.type) {
|
|
12077
12086
|
case "fleet_decision_create": {
|
|
12087
|
+
const scoped = this.decisionScopeFor(instanceName, payload.scope, payload.team);
|
|
12088
|
+
if ("error" in scoped) {
|
|
12089
|
+
ipc.send({ type: "fleet_decision_response", fleetRequestId, error: scoped.error });
|
|
12090
|
+
return;
|
|
12091
|
+
}
|
|
12078
12092
|
const supersedes = this.decisionSupersedes("ipc-typed", instanceName, payload.supersedes);
|
|
12079
12093
|
if ("error" in supersedes) {
|
|
12080
12094
|
ipc.send({ type: "fleet_decision_response", fleetRequestId, error: supersedes.error });
|
|
@@ -12084,7 +12098,9 @@ export class FleetManager {
|
|
|
12084
12098
|
db.pruneExpiredDecisions();
|
|
12085
12099
|
result = db.createDecision({
|
|
12086
12100
|
project_root: projectRoot,
|
|
12087
|
-
scope:
|
|
12101
|
+
scope: scoped.scope,
|
|
12102
|
+
team: scoped.team,
|
|
12103
|
+
poster_teams: scoped.teams,
|
|
12088
12104
|
title: payload.title,
|
|
12089
12105
|
content: payload.content,
|
|
12090
12106
|
tags: payload.tags,
|
|
@@ -12100,10 +12116,16 @@ export class FleetManager {
|
|
|
12100
12116
|
result = decisionListAnswer(db.listDecisions(projectRoot, {
|
|
12101
12117
|
includeArchived: payload.include_archived,
|
|
12102
12118
|
tags: payload.tags,
|
|
12119
|
+
teams: instanceTeams(this.fleetConfig?.teams, instanceName),
|
|
12103
12120
|
}), { id: payload.id, full: payload.full });
|
|
12104
12121
|
break;
|
|
12105
12122
|
case "fleet_decision_update": {
|
|
12106
12123
|
const id = payload.id;
|
|
12124
|
+
const hidden = this.decisionHiddenFrom(instanceName, id);
|
|
12125
|
+
if (hidden) {
|
|
12126
|
+
ipc.send({ type: "fleet_decision_response", fleetRequestId, error: hidden });
|
|
12127
|
+
return;
|
|
12128
|
+
}
|
|
12107
12129
|
if (payload.archive) {
|
|
12108
12130
|
db.archiveDecision(id);
|
|
12109
12131
|
result = { archived: true, id };
|
|
@@ -12282,6 +12304,47 @@ export class FleetManager {
|
|
|
12282
12304
|
return { error: `Superseding a decision needs update_decision. ${permitted.message}` };
|
|
12283
12305
|
return { id: value };
|
|
12284
12306
|
}
|
|
12307
|
+
/**
|
|
12308
|
+
* The scope (and team) a new decision gets. Team membership is read from fleet.yaml now. Omitted scope: the poster's
|
|
12309
|
+
* team when they are in exactly one, project (this exact directory) when they are in none; in several, they choose.
|
|
12310
|
+
* A team decision goes only to a team the poster is in.
|
|
12311
|
+
*/
|
|
12312
|
+
decisionScopeFor(instance, scope, team) {
|
|
12313
|
+
const teams = instanceTeams(this.fleetConfig?.teams, instance);
|
|
12314
|
+
const named = typeof team === "string" && team.trim() ? team.trim() : undefined;
|
|
12315
|
+
if (scope !== undefined && scope !== null && scope !== "project" && scope !== "team" && scope !== "fleet") {
|
|
12316
|
+
return { error: `scope must be "project", "team" or "fleet"` };
|
|
12317
|
+
}
|
|
12318
|
+
if (scope === "project" || scope === "fleet") {
|
|
12319
|
+
return named ? { error: `team goes with scope "team", not "${scope}"` } : { scope, teams };
|
|
12320
|
+
}
|
|
12321
|
+
if (named) {
|
|
12322
|
+
if (!teams.includes(named)) {
|
|
12323
|
+
return { error: teams.length ? `You are not in team "${named}". Your teams: ${teams.join(", ")}` : `You are not in team "${named}" (you are in no team)` };
|
|
12324
|
+
}
|
|
12325
|
+
return { scope: "team", team: named, teams };
|
|
12326
|
+
}
|
|
12327
|
+
if (teams.length === 1)
|
|
12328
|
+
return { scope: "team", team: teams[0], teams };
|
|
12329
|
+
if (teams.length > 1)
|
|
12330
|
+
return { error: `You are in several teams (${teams.join(", ")}): name one with team, or use scope "project" or "fleet"` };
|
|
12331
|
+
if (scope === "team")
|
|
12332
|
+
return { error: `You are in no team: use scope "project" (this directory) or "fleet"` };
|
|
12333
|
+
return { scope: "project", teams };
|
|
12334
|
+
}
|
|
12335
|
+
/**
|
|
12336
|
+
* #3421 review: a team decision is only for its team's current members — reading it back through an update (even an
|
|
12337
|
+
* empty one) or archiving it is refused to anyone else, exactly as list/get and supersede are. The refusal names it
|
|
12338
|
+
* "not found", as for an id that does not exist, and changes nothing. Project and fleet decisions: as before.
|
|
12339
|
+
*/
|
|
12340
|
+
decisionHiddenFrom(instance, id) {
|
|
12341
|
+
if (typeof id !== "string" || !this.scheduler)
|
|
12342
|
+
return null;
|
|
12343
|
+
const d = this.scheduler.db.getDecision(id);
|
|
12344
|
+
if (!d || d.scope !== "team")
|
|
12345
|
+
return null;
|
|
12346
|
+
return d.team && instanceTeams(this.fleetConfig?.teams, instance).includes(d.team) ? null : `Decision "${id}" not found`;
|
|
12347
|
+
}
|
|
12285
12348
|
async handleDecisionCrudHttp(instance, op, args) {
|
|
12286
12349
|
if (!this.scheduler)
|
|
12287
12350
|
return { error: "Scheduler not available" };
|
|
@@ -12296,14 +12359,18 @@ export class FleetManager {
|
|
|
12296
12359
|
const content = asStr(args.content);
|
|
12297
12360
|
if (!title || !content)
|
|
12298
12361
|
return { error: "title and content are required" };
|
|
12299
|
-
const
|
|
12362
|
+
const scoped = this.decisionScopeFor(instance, args.scope, args.team);
|
|
12363
|
+
if ("error" in scoped)
|
|
12364
|
+
return { error: scoped.error };
|
|
12300
12365
|
const supersedes = this.decisionSupersedes("agent-endpoint", instance, args.supersedes);
|
|
12301
12366
|
if ("error" in supersedes)
|
|
12302
12367
|
return { error: supersedes.error };
|
|
12303
12368
|
try {
|
|
12304
12369
|
return db.createDecision({
|
|
12305
12370
|
project_root: projectRoot,
|
|
12306
|
-
scope,
|
|
12371
|
+
scope: scoped.scope,
|
|
12372
|
+
team: scoped.team,
|
|
12373
|
+
poster_teams: scoped.teams,
|
|
12307
12374
|
title,
|
|
12308
12375
|
content,
|
|
12309
12376
|
tags: asStrArr(args.tags),
|
|
@@ -12325,11 +12392,15 @@ export class FleetManager {
|
|
|
12325
12392
|
return decisionListAnswer(db.listDecisions(projectRoot, {
|
|
12326
12393
|
includeArchived: args.includeArchived === true || args.include_archived === true,
|
|
12327
12394
|
tags: asStrArr(args.tags),
|
|
12395
|
+
teams: instanceTeams(this.fleetConfig?.teams, instance),
|
|
12328
12396
|
}), { id: op === "get" ? asStr(args.id) ?? "" : args.id, full: args.full });
|
|
12329
12397
|
case "update": {
|
|
12330
12398
|
const id = asStr(args.id);
|
|
12331
12399
|
if (!id)
|
|
12332
12400
|
return { error: "id is required" };
|
|
12401
|
+
const hidden = this.decisionHiddenFrom(instance, id);
|
|
12402
|
+
if (hidden)
|
|
12403
|
+
return { error: hidden };
|
|
12333
12404
|
return db.updateDecision(id, {
|
|
12334
12405
|
content: asStr(args.content),
|
|
12335
12406
|
tags: asStrArr(args.tags),
|
|
@@ -19624,7 +19695,11 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
|
|
|
19624
19695
|
// re-enters this path.
|
|
19625
19696
|
const selfMentionRe = new RegExp(`<@${adapterBotUserId}>`, "g");
|
|
19626
19697
|
const strippedText = text.replace(selfMentionRe, "").trim();
|
|
19627
|
-
|
|
19698
|
+
// A bare @mention says nothing by itself, so it is dropped (unchanged)... unless it is a REPLY that carries the mention: then the
|
|
19699
|
+
// replied-to message is what is being asked about, and it travels as reply_to_text (#3340). Telegram already forwards this shape
|
|
19700
|
+
// ("/chat @bot (you)"). Only with the mention in the text: an empty reply to one of our own messages (addressed through #2551, a
|
|
19701
|
+
// sticker or embed only) stays dropped, never an empty turn quoting our own answer (Fable #3342 F1).
|
|
19702
|
+
if (!strippedText && !msg.attachments?.length && !(msg.replyToText && mentionTag && addressText.includes(mentionTag)))
|
|
19628
19703
|
return;
|
|
19629
19704
|
const selfMarker = mentionWorld?.botUsername ? `@${mentionWorld.botUsername} (you)` : `${mentionTag} (you)`;
|
|
19630
19705
|
const cleanText = text.replace(selfMentionRe, selfMarker).trim();
|
|
@@ -22764,7 +22839,9 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
|
|
|
22764
22839
|
return {
|
|
22765
22840
|
ok: false,
|
|
22766
22841
|
status: 503,
|
|
22767
|
-
error:
|
|
22842
|
+
error: this.isWebOnlyFleet()
|
|
22843
|
+
? "the restart rate-limit file cannot be read"
|
|
22844
|
+
: "the restart rate-limit file cannot be read — send /restart in General",
|
|
22768
22845
|
};
|
|
22769
22846
|
}
|
|
22770
22847
|
return {
|
|
@@ -22794,7 +22871,7 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
|
|
|
22794
22871
|
return {
|
|
22795
22872
|
ok: false,
|
|
22796
22873
|
status: 409,
|
|
22797
|
-
error: "no chat channel is available to announce the restart
|
|
22874
|
+
error: "no chat channel is available to announce the restart",
|
|
22798
22875
|
};
|
|
22799
22876
|
}
|
|
22800
22877
|
// Consume the row: it moves to running, which is also what lets the next
|