@songsid/agend 2.1.12-beta.4 → 2.1.12-beta.6

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.
Files changed (55) hide show
  1. package/dist/backend/antigravity.d.ts +51 -10
  2. package/dist/backend/antigravity.js +142 -18
  3. package/dist/backend/antigravity.js.map +1 -1
  4. package/dist/backend/codex-metadata.js +4 -0
  5. package/dist/backend/codex-metadata.js.map +1 -1
  6. package/dist/backend/effort-metadata.d.ts +9 -0
  7. package/dist/backend/effort-metadata.js +29 -0
  8. package/dist/backend/effort-metadata.js.map +1 -1
  9. package/dist/backend/kiro.js +6 -2
  10. package/dist/backend/kiro.js.map +1 -1
  11. package/dist/backend/muse.d.ts +5 -0
  12. package/dist/backend/muse.js +29 -0
  13. package/dist/backend/muse.js.map +1 -1
  14. package/dist/backend/types.d.ts +8 -0
  15. package/dist/backend/types.js +9 -3
  16. package/dist/backend/types.js.map +1 -1
  17. package/dist/config-validator.js +34 -0
  18. package/dist/config-validator.js.map +1 -1
  19. package/dist/daemon.d.ts +4 -0
  20. package/dist/daemon.js +29 -31
  21. package/dist/daemon.js.map +1 -1
  22. package/dist/delivery-outbox.d.ts +2 -0
  23. package/dist/delivery-outbox.js +7 -0
  24. package/dist/delivery-outbox.js.map +1 -1
  25. package/dist/event-log.d.ts +1 -0
  26. package/dist/event-log.js +5 -1
  27. package/dist/event-log.js.map +1 -1
  28. package/dist/event-loop-watch.d.ts +18 -0
  29. package/dist/event-loop-watch.js +32 -3
  30. package/dist/event-loop-watch.js.map +1 -1
  31. package/dist/fleet-manager.d.ts +3 -0
  32. package/dist/fleet-manager.js +23 -5
  33. package/dist/fleet-manager.js.map +1 -1
  34. package/dist/instance-lifecycle.js +11 -0
  35. package/dist/instance-lifecycle.js.map +1 -1
  36. package/dist/locale.js +2 -0
  37. package/dist/locale.js.map +1 -1
  38. package/dist/login-flows.js +5 -1
  39. package/dist/login-flows.js.map +1 -1
  40. package/dist/outbound-schemas.js +1 -1
  41. package/dist/outbound-schemas.js.map +1 -1
  42. package/dist/prompt-file-ref.d.ts +42 -0
  43. package/dist/prompt-file-ref.js +118 -0
  44. package/dist/prompt-file-ref.js.map +1 -0
  45. package/dist/statusline-watcher.js +2 -1
  46. package/dist/statusline-watcher.js.map +1 -1
  47. package/dist/sync-work-attribution.d.ts +9 -0
  48. package/dist/sync-work-attribution.js +25 -0
  49. package/dist/sync-work-attribution.js.map +1 -0
  50. package/dist/topic-commands.js +10 -3
  51. package/dist/topic-commands.js.map +1 -1
  52. package/dist/transcript-sources.d.ts +1 -27
  53. package/dist/transcript-sources.js +9 -0
  54. package/dist/transcript-sources.js.map +1 -1
  55. package/package.json +1 -1
package/dist/daemon.js CHANGED
@@ -16,6 +16,7 @@ import { resolveToolSet } from "./tool-permissions.js";
16
16
  import { getAgendHome } from "./paths.js";
17
17
  import { LOGIN_FLOWS } from "./login-flows.js";
18
18
  import { ProgressAccumulator, summarizeProgress } from "./tool-progress.js";
19
+ import { assembleSystemPrompt, resolveWorkflowText } from "./prompt-file-ref.js";
19
20
  import { isCrossInstanceVisibility } from "./cross-instance-notice.js";
20
21
  import { ContextGuardian } from "./context-guardian.js";
21
22
  import { IpcServer } from "./channel/ipc-bridge.js";
@@ -1005,6 +1006,8 @@ export class Daemon extends EventEmitter {
1005
1006
  spawnGate;
1006
1007
  stormWindow;
1007
1008
  backendOutage;
1009
+ /** #1314: fleet-directory fallbacks already reported to the topic (once per daemon, per field and path). */
1010
+ promptFileFallbackNoticed = new Set();
1008
1011
  /** Identity of this live Daemon object; changes on object stop/restart. */
1009
1012
  bootId = randomUUID();
1010
1013
  deliveryOutbox;
@@ -8597,6 +8600,26 @@ export class Daemon extends EventEmitter {
8597
8600
  respond(null, `Unknown tool: ${tool}`);
8598
8601
  }
8599
8602
  }
8603
+ /** Where this instance's `file:` refs resolve, and what a problem with one reports — never the file's contents. */
8604
+ promptFileContext() {
8605
+ return {
8606
+ workingDirectory: this.config.working_directory,
8607
+ // The only reader of the fleet's cwd: the one-release fallback to where these refs used to resolve.
8608
+ fleetCwd: process.cwd(),
8609
+ onWarning: (warning) => {
8610
+ if (warning.problem === "fleet_dir_fallback") {
8611
+ this.logger.warn({ field: warning.field, path: warning.path, legacyPath: warning.legacyPath }, `${warning.field} file: ref is not under the instance's working directory (${warning.path}); read ${warning.legacyPath} from the fleet directory instead — make the path absolute or move the file. The fallback is removed in 2.2.`);
8612
+ const key = `${warning.field}:${warning.path}`;
8613
+ if (!this.promptFileFallbackNoticed.has(key)) {
8614
+ this.promptFileFallbackNoticed.add(key);
8615
+ this.emit("prompt_file_fallback", { name: this.name, field: warning.field, path: warning.path, legacyPath: warning.legacyPath });
8616
+ }
8617
+ return;
8618
+ }
8619
+ this.logger.warn({ field: warning.field, path: warning.path, problem: warning.problem, code: warning.code }, `${warning.field} file: ref gives nothing (${warning.problem}${warning.code ? ` ${warning.code}` : ""}): ${warning.path}`);
8620
+ },
8621
+ };
8622
+ }
8600
8623
  /** Build config object for the CLI backend */
8601
8624
  buildBackendConfig() {
8602
8625
  // Antigravity 1.1.17 has no per-workspace MCP config, but its global MCP
@@ -8609,44 +8632,19 @@ export class Daemon extends EventEmitter {
8609
8632
  serverJs = join(__dirname, "..", "dist", "channel", "mcp-server.js");
8610
8633
  }
8611
8634
  // ── Resolve workflow and systemPrompt once, share between MCP env and instructions ──
8635
+ // #1314: `file:` refs are relative to this instance's working directory (src/prompt-file-ref.ts).
8636
+ const promptFiles = this.promptFileContext();
8612
8637
  let resolvedWorkflow;
8613
8638
  if (this.config.workflow === false) {
8614
8639
  resolvedWorkflow = false;
8615
8640
  }
8616
8641
  else {
8617
8642
  const wf = this.config.workflow ?? "builtin";
8618
- if (wf !== "builtin") {
8619
- let content = wf;
8620
- if (content.startsWith("file:")) {
8621
- try {
8622
- content = readFileSync(content.slice(5), "utf-8");
8623
- }
8624
- catch {
8625
- content = "";
8626
- }
8627
- }
8628
- resolvedWorkflow = content || undefined;
8629
- }
8630
- }
8631
- let resolvedCustomPrompt;
8632
- if (this.config.systemPrompt) {
8633
- // Support comma-separated file: paths for prompt modularization:
8634
- // systemPrompt: "file:prompts/role.md, file:prompts/rules.md, file:prompts/context.md"
8635
- const parts = this.config.systemPrompt.split(",").map((s) => s.trim());
8636
- const resolved = parts.map((part) => {
8637
- if (part.startsWith("file:")) {
8638
- try {
8639
- return readFileSync(part.slice(5), "utf-8");
8640
- }
8641
- catch {
8642
- return "";
8643
- }
8644
- }
8645
- return part;
8646
- }).filter(Boolean);
8647
- if (resolved.length > 0)
8648
- resolvedCustomPrompt = resolved.join("\n\n");
8643
+ if (wf !== "builtin")
8644
+ resolvedWorkflow = resolveWorkflowText(wf, promptFiles) || undefined;
8649
8645
  }
8646
+ // Comma-separated parts (`file:role.md, file:rules.md`) only when a part is a file ref; otherwise one inline prompt.
8647
+ const resolvedCustomPrompt = this.config.systemPrompt ? assembleSystemPrompt(this.config.systemPrompt, promptFiles) : undefined;
8650
8648
  let decisions;
8651
8649
  if (process.env.AGEND_DECISIONS) {
8652
8650
  try {