@cortexkit/aft-pi 0.58.2 → 0.59.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.
Files changed (45) hide show
  1. package/README.md +4 -0
  2. package/dist/bg-notifications.d.ts +8 -0
  3. package/dist/bg-notifications.d.ts.map +1 -1
  4. package/dist/config.d.ts +84 -21
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/index.d.ts +4 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3211 -1305
  9. package/dist/lsp-auto-install.d.ts.map +1 -1
  10. package/dist/lsp-github-install.d.ts +5 -2
  11. package/dist/lsp-github-install.d.ts.map +1 -1
  12. package/dist/notifications.d.ts +1 -1
  13. package/dist/notifications.d.ts.map +1 -1
  14. package/dist/omp-internal-urls.d.ts +17 -0
  15. package/dist/omp-internal-urls.d.ts.map +1 -0
  16. package/dist/shared/status.d.ts +1 -0
  17. package/dist/shared/status.d.ts.map +1 -1
  18. package/dist/tool-registration.d.ts.map +1 -1
  19. package/dist/tools/_shared.d.ts.map +1 -1
  20. package/dist/tools/ast.d.ts +1 -18
  21. package/dist/tools/ast.d.ts.map +1 -1
  22. package/dist/tools/bash.d.ts +4 -0
  23. package/dist/tools/bash.d.ts.map +1 -1
  24. package/dist/tools/fs.d.ts +2 -12
  25. package/dist/tools/fs.d.ts.map +1 -1
  26. package/dist/tools/hoisted.d.ts.map +1 -1
  27. package/dist/tools/imports.d.ts +3 -19
  28. package/dist/tools/imports.d.ts.map +1 -1
  29. package/dist/tools/inspect.d.ts +11 -9
  30. package/dist/tools/inspect.d.ts.map +1 -1
  31. package/dist/tools/navigate.d.ts +3 -17
  32. package/dist/tools/navigate.d.ts.map +1 -1
  33. package/dist/tools/reading.d.ts +3 -8
  34. package/dist/tools/reading.d.ts.map +1 -1
  35. package/dist/tools/render-helpers.d.ts +3 -1
  36. package/dist/tools/render-helpers.d.ts.map +1 -1
  37. package/dist/tools/safety.d.ts +3 -11
  38. package/dist/tools/safety.d.ts.map +1 -1
  39. package/dist/tools/semantic.d.ts +4 -3
  40. package/dist/tools/semantic.d.ts.map +1 -1
  41. package/dist/types.d.ts +9 -0
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/workflow-hints.d.ts +49 -4
  44. package/dist/workflow-hints.d.ts.map +1 -1
  45. package/package.json +11 -10
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { AftTransportPool } from "@cortexkit/aft-bridge";
2
2
  import type { AftConfig } from "./config.js";
3
+ import type { OmpInternalUrlRouter } from "./omp-internal-urls.js";
3
4
  /**
4
5
  * Shared context passed to every tool wrapper.
5
6
  * Bundles the bridge pool, the resolved AFT config, and the storage dir.
@@ -12,9 +13,17 @@ import type { AftConfig } from "./config.js";
12
13
  export interface PluginContext {
13
14
  pool: AftTransportPool;
14
15
  config: AftConfig;
16
+ /** OMP's process-global internal URL router, absent on upstream Pi. */
17
+ ompRouter?: OmpInternalUrlRouter;
15
18
  /** Whether hashline edit/read mode is active for this plugin registration. */
16
19
  hashlineEffective?: boolean;
17
20
  /** Absolute path to AFT's data storage dir (e.g. ~/.local/share/cortexkit/aft). */
18
21
  storageDir: string;
22
+ /**
23
+ * Starts the work the extension defers until a session needs AFT (LSP
24
+ * discovery and installs, ONNX Runtime preparation, the warmup bridge).
25
+ * Idempotent; a no-op once the host has shut the session down.
26
+ */
27
+ startSessionWork?: () => void;
19
28
  }
20
29
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,uEAAuE;IACvE,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B"}
@@ -39,13 +39,58 @@ interface ToolSurfaceFlags {
39
39
  bashWatch: boolean;
40
40
  bashWrite: boolean;
41
41
  }
42
+ /**
43
+ * Name of the prompt section that carries the hints on hosts with structured
44
+ * system prompt sections. Pi renders it as
45
+ * `<aft_workflow_hints>\n…\n</aft_workflow_hints>` and requires names to match
46
+ * `^[a-z][a-z0-9_-]*$`.
47
+ */
48
+ export declare const WORKFLOW_HINTS_SECTION = "aft_workflow_hints";
49
+ /**
50
+ * The parts of a `before_agent_start` event the hints handler reads, across
51
+ * the hosts the plugin runs on:
52
+ * - upstream Pi 0.86.0 and later expose `systemPromptOptions.sections`, a
53
+ * per-run copy that handlers may mutate, and `forceSystemPrompt`, which is
54
+ * set once any handler has returned `systemPrompt` for this run;
55
+ * - older upstream Pi passes `systemPromptOptions` without `sections` (and it
56
+ * is the session's base options object, so it must not be mutated);
57
+ * - oh-my-pi (OMP) passes `systemPrompt` as an array with one entry per
58
+ * provider system block and has no `systemPromptOptions`.
59
+ */
60
+ export interface WorkflowHintsStartEvent {
61
+ systemPrompt: string | readonly string[];
62
+ systemPromptOptions?: {
63
+ sections?: Record<string, string>;
64
+ forceSystemPrompt?: string;
65
+ };
66
+ }
67
+ export type WorkflowHintsStartResult = {
68
+ systemPrompt: string | string[];
69
+ } | undefined;
70
+ /**
71
+ * Add the hints block to one `before_agent_start` run.
72
+ *
73
+ * Where the host has prompt sections, the block goes into its own section and
74
+ * nothing is returned. Returning `systemPrompt` would force the whole prompt
75
+ * for the run: Pi then sends one collapsed system message and drops the
76
+ * transcript-backed mid-conversation tool and prompt changes, so every later
77
+ * tool activation rewrites the whole prompt cache. As a section, the block is
78
+ * diffed like any other part of the prompt and, being identical on every run,
79
+ * is sent once and stays in the cached prefix.
80
+ *
81
+ * Hosts without sections only accept a returned replacement prompt, so the
82
+ * block is appended to the prompt they passed in: as a new last entry when the
83
+ * prompt is an array of system blocks (OMP), keeping the existing blocks
84
+ * intact, or after a blank line when it is a single string (older Pi).
85
+ */
86
+ export declare function applyWorkflowHints(event: WorkflowHintsStartEvent, hintsBlock: string): WorkflowHintsStartResult;
42
87
  /**
43
88
  * Register the workflow-hints extension on Pi via `before_agent_start`.
44
89
  *
45
- * Pi assembles a fresh system prompt for every turn, then fires
46
- * `before_agent_start` with the assembled prompt. Our handler appends the
47
- * AFT workflow hints block to that prompt. If multiple extensions return a
48
- * `systemPrompt`, Pi chains them — so we always append (never replace).
90
+ * Pi fires `before_agent_start` once per user prompt with the prompt it
91
+ * assembled; {@link applyWorkflowHints} adds the hints block to it without
92
+ * dropping other extensions' contributions. The block is built once here, so
93
+ * it is byte-identical on every run of the session.
49
94
  * Magic Context's short-lived Pi children don't need these workflow hints.
50
95
  */
51
96
  export declare function registerWorkflowHints(pi: ExtensionAPI, config: AftConfig, surface: ToolSurfaceFlags): void;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-hints.d.ts","sourceRoot":"","s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nB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACzC,mBAAmB,CAAC,EAAE;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAED,MAAM,MAAM,wBAAwB,GAAG;IAAE,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAAC;AAEvF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,EAC9B,UAAU,EAAE,MAAM,GACjB,wBAAwB,CAmB1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,YAAY,EAChB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,gBAAgB,GACxB,IAAI,CA8BN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft-pi",
3
- "version": "0.58.2",
3
+ "version": "0.59.0",
4
4
  "type": "module",
5
5
  "description": "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
6
6
  "main": "dist/index.js",
@@ -15,26 +15,27 @@
15
15
  "README.md"
16
16
  ],
17
17
  "scripts": {
18
- "build": "bun build src/index.ts --outdir dist --target node --format esm --external @earendil-works/pi-coding-agent --external @earendil-works/pi-ai --external @earendil-works/pi-tui --external typebox --external diff && tsc --emitDeclarationOnly",
18
+ "build": "bun build src/index.ts --outdir dist --target node --format esm --external @earendil-works/pi-coding-agent --external @earendil-works/pi-ai --external @earendil-works/pi-tui --external @oh-my-pi/pi-coding-agent/internal-urls --external typebox --external diff && tsc --emitDeclarationOnly",
19
19
  "typecheck": "tsc --noEmit",
20
20
  "test": "bun test src/__tests__/",
21
21
  "lint": "biome check src",
22
22
  "prepublishOnly": "bun run build",
23
- "test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
23
+ "test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'",
24
+ "test:e2e": "bun test src/__tests__/e2e/"
24
25
  },
25
26
  "dependencies": {
26
- "@cortexkit/aft-bridge": "0.58.2",
27
+ "@cortexkit/aft-bridge": "0.59.0",
27
28
  "comment-json": "^5.0.0",
28
29
  "diff": "^8.0.4",
29
30
  "zod": "^4.4.3"
30
31
  },
31
32
  "optionalDependencies": {
32
- "@cortexkit/aft-darwin-arm64": "0.58.2",
33
- "@cortexkit/aft-darwin-x64": "0.58.2",
34
- "@cortexkit/aft-linux-arm64": "0.58.2",
35
- "@cortexkit/aft-linux-x64": "0.58.2",
36
- "@cortexkit/aft-win32-arm64": "0.58.2",
37
- "@cortexkit/aft-win32-x64": "0.58.2"
33
+ "@cortexkit/aft-darwin-arm64": "0.59.0",
34
+ "@cortexkit/aft-darwin-x64": "0.59.0",
35
+ "@cortexkit/aft-linux-arm64": "0.59.0",
36
+ "@cortexkit/aft-linux-x64": "0.59.0",
37
+ "@cortexkit/aft-win32-arm64": "0.59.0",
38
+ "@cortexkit/aft-win32-x64": "0.59.0"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@earendil-works/pi-coding-agent": "^0.80.2",