pim-agent 0.12.1 → 0.14.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/package.json +4 -3
- package/packages/core/src/attachments/AttachmentStore.ts +8 -13
- package/packages/core/src/attachments/Attachments.ts +2 -4
- package/packages/core/src/extensions/CoreExtensions.ts +1 -1
- package/packages/core/src/extensions/apply-patch/coordinator.ts +1 -1
- package/packages/core/src/extensions/apply-patch/executor.ts +21 -25
- package/packages/core/src/extensions/apply-patch/matcher.ts +1 -1
- package/packages/core/src/extensions/apply-patch/model.ts +2 -6
- package/packages/core/src/extensions/apply-patch/parser.ts +60 -162
- package/packages/core/src/extensions/apply-patch/schema.ts +0 -1
- package/packages/core/src/extensions/bash/MemoryCap.ts +5 -4
- package/packages/core/src/extensions/bash/capture.ts +16 -23
- package/packages/core/src/extensions/bash/format.ts +2 -2
- package/packages/core/src/extensions/bash/image.ts +4 -8
- package/packages/core/src/extensions/bash/index.ts +1 -1
- package/packages/core/src/extensions/bash/render.ts +1 -1
- package/packages/core/src/extensions/bash/run.ts +9 -15
- package/packages/core/src/extensions/bash/schema.ts +4 -4
- package/packages/core/src/extensions/edit/edit.ts +14 -33
- package/packages/core/src/extensions/glob/glob.ts +1 -3
- package/packages/core/src/extensions/glob/index.ts +7 -9
- package/packages/core/src/extensions/glob/render.ts +2 -4
- package/packages/core/src/extensions/glob/schema.ts +1 -1
- package/packages/core/src/extensions/grep/grep.ts +7 -7
- package/packages/core/src/extensions/grep/render.ts +5 -6
- package/packages/core/src/extensions/grep/schema.ts +3 -7
- package/packages/core/src/extensions/read/ImageMemory.ts +2 -8
- package/packages/core/src/extensions/read/image.ts +3 -3
- package/packages/core/src/extensions/read/index.ts +2 -14
- package/packages/core/src/extensions/read/read.ts +5 -6
- package/packages/core/src/extensions/read/render.ts +1 -1
- package/packages/core/src/extensions/read/schema.ts +2 -2
- package/packages/core/src/extensions/subagent/render.ts +2 -2
- package/packages/core/src/extensions/subagent/subagent.ts +10 -21
- package/packages/core/src/extensions/system-prompt/index.ts +3 -2
- package/packages/core/src/extensions/system-prompt/prompt.ts +13 -3
- package/packages/core/src/extensions/todo/render.ts +1 -4
- package/packages/core/src/extensions/todo/todo.ts +16 -23
- package/packages/core/src/extensions/web-fetch/JinaReaderClient.ts +3 -11
- package/packages/core/src/extensions/web-fetch/WebViewFetchClient.ts +1 -3
- package/packages/core/src/extensions/web-fetch/fetch.ts +4 -12
- package/packages/core/src/extensions/web-fetch/image.ts +3 -4
- package/packages/core/src/extensions/web-fetch/index.ts +2 -13
- package/packages/core/src/extensions/web-fetch/render.ts +3 -4
- package/packages/core/src/extensions/web-fetch/schema.ts +3 -4
- package/packages/core/src/extensions/web-search/ExaMcpClient.ts +23 -31
- package/packages/core/src/extensions/web-search/SearchBreaker.ts +1 -1
- package/packages/core/src/extensions/web-search/SearchChain.ts +6 -5
- package/packages/core/src/extensions/web-search/providers/DuckDuckGoProvider.ts +2 -2
- package/packages/core/src/extensions/web-search/providers/FirecrawlProvider.ts +1 -2
- package/packages/core/src/extensions/web-search/providers/SearchProvider.ts +3 -3
- package/packages/core/src/extensions/write/write.ts +1 -1
- package/packages/core/src/picker/InProcessFilePickerSuggestionEngine.ts +1 -3
- package/packages/core/src/picker/PickerItem.ts +1 -1
- package/packages/core/src/picker/PickerService.ts +3 -7
- package/packages/core/src/picker/RemoteFilePickerSuggestionEngine.ts +1 -2
- package/packages/core/src/picker/catalog.ts +7 -15
- package/packages/core/src/picker/filePickerWorker.ts +1 -3
- package/packages/core/src/picker/ranker.ts +1 -1
- package/packages/core/src/picker/token.ts +3 -4
- package/packages/core/src/session/AgentRuntime.ts +5 -8
- package/packages/core/src/session/EventLog.ts +6 -12
- package/packages/core/src/session/ReadCursors.ts +3 -4
- package/packages/core/src/session/SearchIndex.ts +49 -86
- package/packages/core/src/session/SearchTokens.ts +4 -7
- package/packages/core/src/session/SessionCache.ts +8 -6
- package/packages/core/src/session/SessionDigest.ts +10 -19
- package/packages/core/src/session/SessionHost.ts +53 -83
- package/packages/core/src/session/SessionLease.ts +12 -15
- package/packages/core/src/session/SessionMeta.ts +16 -32
- package/packages/core/src/session/SessionName.ts +3 -7
- package/packages/core/src/session/SessionRegistry.ts +13 -29
- package/packages/core/src/session/SessionUi.ts +12 -16
- package/packages/core/src/session/WriteMark.ts +7 -16
- package/packages/core/src/shared/Cli.ts +1 -1
- package/packages/core/src/shared/DaemonUnit.ts +1 -2
- package/packages/core/src/shared/DiffLines.ts +16 -34
- package/packages/core/src/shared/DiffRenderer.ts +8 -27
- package/packages/core/src/shared/Directories.ts +4 -4
- package/packages/core/src/shared/EditMatcher.ts +18 -50
- package/packages/core/src/shared/ExtensionToggles.ts +3 -6
- package/packages/core/src/shared/FileEnumerator.ts +73 -57
- package/packages/core/src/shared/FileScanner.ts +5 -13
- package/packages/core/src/shared/FileWatch.ts +13 -17
- package/packages/core/src/shared/Format.ts +2 -3
- package/packages/core/src/shared/FuzzyMatcher.ts +18 -19
- package/packages/core/src/shared/Git.ts +22 -47
- package/packages/core/src/shared/GitMonitor.ts +12 -23
- package/packages/core/src/shared/GlobExclusions.ts +0 -4
- package/packages/core/src/shared/Http.ts +1 -1
- package/packages/core/src/shared/ImageMime.ts +3 -5
- package/packages/core/src/shared/Images.ts +17 -27
- package/packages/core/src/shared/Languages.ts +2 -2
- package/packages/core/src/shared/Levenshtein.ts +1 -6
- package/packages/core/src/shared/Lines.ts +1 -1
- package/packages/core/src/shared/McpClient.ts +2 -2
- package/packages/core/src/shared/PatchSummary.ts +1 -1
- package/packages/core/src/shared/Paths.ts +4 -1
- package/packages/core/src/shared/PiExtensions.ts +5 -12
- package/packages/core/src/shared/PimSettings.ts +14 -15
- package/packages/core/src/shared/Proc.ts +2 -3
- package/packages/core/src/shared/RateLimiter.ts +1 -1
- package/packages/core/src/shared/Renderer.ts +1 -3
- package/packages/core/src/shared/RepoDiff.ts +24 -46
- package/packages/core/src/shared/SearchRender.ts +3 -4
- package/packages/core/src/shared/SpillCache.ts +2 -3
- package/packages/core/src/shared/SubagentLogs.ts +4 -6
- package/packages/core/src/shared/Supervisor.ts +19 -32
- package/packages/core/src/shared/Surface.ts +1 -1
- package/packages/core/src/shared/Sweeper.ts +1 -1
- package/packages/core/src/shared/Tools.ts +17 -30
- package/packages/core/src/shared/Updater.ts +15 -15
- package/packages/core/src/view/BodyRenderer.ts +1 -1
- package/packages/core/src/view/DiffBlocks.ts +0 -1
- package/packages/core/src/view/DiffExpand.ts +10 -25
- package/packages/core/src/view/DiffLayout.ts +2 -2
- package/packages/core/src/view/DiffPairs.ts +2 -2
- package/packages/core/src/view/MarkdownPainter.ts +2 -19
- package/packages/core/src/view/MovePath.ts +4 -17
- package/packages/core/src/view/Painting.ts +4 -4
- package/packages/core/src/view/ViewBlock.ts +11 -12
- package/packages/daemon/src/Daemon.ts +2 -7
- package/packages/daemon/src/DaemonInstall.ts +5 -12
- package/packages/daemon/src/Surfaces.ts +3 -12
- package/packages/daemon/src/TelegramSurface.ts +0 -1
- package/packages/daemon/src/index.ts +0 -1
- package/packages/protocol/src/Command.ts +33 -41
- package/packages/protocol/src/Diff.ts +0 -5
- package/packages/protocol/src/ImageRoute.ts +2 -5
- package/packages/protocol/src/ServerEvent.ts +68 -105
- package/packages/server/src/AttachmentEndpoint.ts +45 -19
- package/packages/server/src/ClientConnection.ts +11 -12
- package/packages/server/src/ImageEndpoint.ts +3 -4
- package/packages/server/src/ProbeClient.ts +26 -59
- package/packages/server/src/Reloader.ts +4 -7
- package/packages/server/src/SendFileTool.ts +1 -1
- package/packages/server/src/SessionCatalogue.ts +35 -47
- package/packages/server/src/SessionProjection.ts +7 -12
- package/packages/server/src/SessionStream.ts +33 -80
- package/packages/server/src/StaticClient.ts +7 -8
- package/packages/server/src/WebOptions.ts +2 -6
- package/packages/server/src/WsGateway.ts +35 -96
- package/packages/server/src/probe.ts +6 -18
- package/packages/telegram/src/Bot.ts +2 -2
- package/packages/telegram/src/Commands.ts +108 -65
- package/packages/telegram/src/Config.ts +1 -6
- package/packages/telegram/src/Markdown.ts +4 -13
- package/packages/telegram/src/Renderer.ts +1 -1
- package/packages/telegram/src/Session.ts +3 -10
- package/packages/telegram/src/TaskScheduler.ts +31 -10
- package/packages/telegram/src/TaskStore.ts +11 -1
- package/packages/telegram/src/TaskTool.ts +1 -1
- package/packages/telegram/src/UpdateConfirm.ts +2 -2
- package/packages/tui/src/extensions/_init/index.ts +2 -5
- package/packages/tui/src/extensions/file-picker/index.ts +2 -6
- package/packages/tui/src/extensions/footer/index.ts +0 -1
- package/packages/tui/src/extensions/footer/powerline.ts +16 -28
- package/packages/tui/src/extensions/pim/index.ts +1 -1
- package/packages/tui/src/extensions/session-lease/index.ts +5 -6
- package/packages/tui/src/extensions/working-indicator/index.ts +1 -2
- package/packages/tui/src/themes/themeCliArgs.ts +1 -1
- package/packages/web/dist/client/assets/abnfDiagram-O67JEVCF-WweOU5DK.js +1 -0
- package/packages/web/dist/client/assets/arc-O2PmZXWt.js +1 -0
- package/packages/web/dist/client/assets/architecture-7GRP2DOG-COBxVilU.js +1 -0
- package/packages/web/dist/client/assets/architectureDiagram-NJMV4G6O-DwYq1YaM.js +36 -0
- package/packages/web/dist/client/assets/array-BifhSqXX.js +1 -0
- package/packages/web/dist/client/assets/blockDiagram-BEXU5L5S-CVab041n.js +140 -0
- package/packages/web/dist/client/assets/c4Diagram-YGBWAQC7-BmotHez3.js +38 -0
- package/packages/web/dist/client/assets/channel-BKV-IcTA.js +1 -0
- package/packages/web/dist/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/packages/web/dist/client/assets/chunk-3FUC2YCW-CWNS7-n4.js +2 -0
- package/packages/web/dist/client/assets/chunk-5DYCD2WN-DflvXohu.js +1 -0
- package/packages/web/dist/client/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/packages/web/dist/client/assets/chunk-742MDFTN-B_0t6_RE.js +1 -0
- package/packages/web/dist/client/assets/chunk-7INBJB4K-wKj0Q3Kv.js +62 -0
- package/packages/web/dist/client/assets/chunk-7M6MHVWA-BMvUghc8.js +213 -0
- package/packages/web/dist/client/assets/chunk-7PRAP22T-BY41wkcT.js +1 -0
- package/packages/web/dist/client/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
- package/packages/web/dist/client/assets/chunk-FOHPRMQF-CoA4358r.js +161 -0
- package/packages/web/dist/client/assets/chunk-GTNCS2PH-PqY_YoS0.js +88 -0
- package/packages/web/dist/client/assets/chunk-GWA4HPMP-fozSU5ty.js +1 -0
- package/packages/web/dist/client/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
- package/packages/web/dist/client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/packages/web/dist/client/assets/chunk-MBY4JIJT-CrHrC3jw.js +72 -0
- package/packages/web/dist/client/assets/chunk-NETBCI7D-DWdAxieG.js +1 -0
- package/packages/web/dist/client/assets/chunk-O7XYJQB3-B6uOn9iS.js +128 -0
- package/packages/web/dist/client/assets/chunk-UA2S7LBM-BxYSHqyy.js +1 -0
- package/packages/web/dist/client/assets/chunk-WEXAMYUT-CtwIaQDa.js +1 -0
- package/packages/web/dist/client/assets/chunk-XXDRQBXY-fgBFe-PX.js +1 -0
- package/packages/web/dist/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/packages/web/dist/client/assets/chunk-Z7XXMR3K-CPonoV3p.js +10 -0
- package/packages/web/dist/client/assets/chunk-ZIGJFQKS-Cdu87cTj.js +2 -0
- package/packages/web/dist/client/assets/classDiagram-v2-NBCMYWYE-DSWsPaa7.js +217 -0
- package/packages/web/dist/client/assets/core-CBoS7AST.js +3 -0
- package/packages/web/dist/client/assets/cose-bilkent-JH36ORCC-CTwlldtJ.js +1 -0
- package/packages/web/dist/client/assets/cynefin-OW5HDTMX-CZQ4EPNJ.js +1 -0
- package/packages/web/dist/client/assets/cynefinDiagram-VND7K2PF-C2gp6H_Q.js +62 -0
- package/packages/web/dist/client/assets/cytoscape.esm-B-1iW2ft.js +321 -0
- package/packages/web/dist/client/assets/dagre-6A5THRUB-CDxTP47t.js +4 -0
- package/packages/web/dist/client/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/packages/web/dist/client/assets/diagram-22UHCM2B-BIohE1lI.js +200 -0
- package/packages/web/dist/client/assets/diagram-3UASUU5V-TwAUir-w.js +24 -0
- package/packages/web/dist/client/assets/diagram-ATOU4E4O-BM1JQrIu.js +3 -0
- package/packages/web/dist/client/assets/diagram-CDSNMT55-BKIqhxSI.js +30 -0
- package/packages/web/dist/client/assets/diagram-MLGK6HIB-CVe3QDHr.js +24 -0
- package/packages/web/dist/client/assets/diagram-MPIPVDR6-Bj-MQIFI.js +41 -0
- package/packages/web/dist/client/assets/dist-DlZpcyc2.js +1 -0
- package/packages/web/dist/client/assets/ebnfDiagram-ZINNZB2B-C06mmvmz.js +1 -0
- package/packages/web/dist/client/assets/elk-276RUBZZ-CizJSNEj.js +27 -0
- package/packages/web/dist/client/assets/erDiagram-OPXOYQCR-M3FQkKI1.js +99 -0
- package/packages/web/dist/client/assets/eventmodeling-NTZA5JFV-D_UXLpIu.js +1 -0
- package/packages/web/dist/client/assets/flowDiagram-KWPJA3E3-BT4eEEVm.js +1 -0
- package/packages/web/dist/client/assets/ganttDiagram-FUAMR5RP-CojF9Q16.js +292 -0
- package/packages/web/dist/client/assets/gitGraph-4MIJSDKK-YvKqGEPk.js +1 -0
- package/packages/web/dist/client/assets/gitGraphDiagram-X574FWY7-XqNqIFo9.js +106 -0
- package/packages/web/dist/client/assets/graphlib-DS17s2tU.js +1 -0
- package/packages/web/dist/client/assets/index--2CDtzvY.css +1 -0
- package/packages/web/dist/client/assets/index-bT6QPJZs.js +47 -0
- package/packages/web/dist/client/assets/info-A6RAGUB7-B_1BCzM2.js +1 -0
- package/packages/web/dist/client/assets/infoDiagram-VRGFBTTK-zFX8B-dP.js +2 -0
- package/packages/web/dist/client/assets/init-C-OQMol4.js +1 -0
- package/packages/web/dist/client/assets/ishikawaDiagram-OU5B5YK6-DLzQ_Uyf.js +70 -0
- package/packages/web/dist/client/assets/journeyDiagram-ZHPQQLJL-S3WRMmoa.js +139 -0
- package/packages/web/dist/client/assets/kanban-definition-PNTS6WVX-B5Z8I-kM.js +89 -0
- package/packages/web/dist/client/assets/katex-ZlcWpGUi.js +257 -0
- package/packages/web/dist/client/assets/line-BGMH-i2X.js +1 -0
- package/packages/web/dist/client/assets/linear-KsrestXG.js +1 -0
- package/packages/web/dist/client/assets/mermaid-parser.core-DNffyJJA.js +7 -0
- package/packages/web/dist/client/assets/mermaid.core-Cz3vJeQG.js +44 -0
- package/packages/web/dist/client/assets/mindmap-definition-NLK3R4M7-CzA61XUf.js +96 -0
- package/packages/web/dist/client/assets/ordinal-BDEzSJ7C.js +1 -0
- package/packages/web/dist/client/assets/packet-AYTQ26CC-BO55e7cR.js +1 -0
- package/packages/web/dist/client/assets/path-fybaL0A-.js +1 -0
- package/packages/web/dist/client/assets/pegDiagram-GJSIUBJH-DeRiXYNd.js +1 -0
- package/packages/web/dist/client/assets/pie-WAS4IAKB-D9ibrQRe.js +1 -0
- package/packages/web/dist/client/assets/pieDiagram-5QR66LMP-BaBpPP33.js +39 -0
- package/packages/web/dist/client/assets/quadrantDiagram-O4NWA36T-DIfn4GjM.js +7 -0
- package/packages/web/dist/client/assets/radar-RG4KPBEZ-Dmn5-nJq.js +1 -0
- package/packages/web/dist/client/assets/railroad-74A4TZTK-ZCWNEd2Z.js +1 -0
- package/packages/web/dist/client/assets/railroad-abnf-HS5TGJTU-_swqhy0y.js +1 -0
- package/packages/web/dist/client/assets/railroad-ebnf-LZEXJU2U-CytbazPx.js +1 -0
- package/packages/web/dist/client/assets/railroad-peg-WCYAUIDC-Bg8QW17T.js +1 -0
- package/packages/web/dist/client/assets/railroadDiagram-XR7U4H2S-CDPZ39sy.js +1 -0
- package/packages/web/dist/client/assets/requirementDiagram-PLB6GJNP-CyCI8Yul.js +84 -0
- package/packages/web/dist/client/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/packages/web/dist/client/assets/sankeyDiagram-IPEJSGJF-p_XAPv72.js +40 -0
- package/packages/web/dist/client/assets/sequenceDiagram-PO4LG4MO-DmR6IP_o.js +169 -0
- package/packages/web/dist/client/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- package/packages/web/dist/client/assets/src-gnv7pJ1z.js +1 -0
- package/packages/web/dist/client/assets/stateDiagram-v2-GCMORJYK-7ZTHl6ih.js +291 -0
- package/packages/web/dist/client/assets/swimlanes-2SLR337P-N6bj71pw.js +1 -0
- package/packages/web/dist/client/assets/swimlanesDiagram-TC7HE7FX-BJQ2CBsp.js +8 -0
- package/packages/web/dist/client/assets/timeline-definition-EJHVYXUP-GNez0kW8.js +120 -0
- package/packages/web/dist/client/assets/treeView-Q6P3EWNA-DyQZkboR.js +1 -0
- package/packages/web/dist/client/assets/treemap-WGGIJYW6-_J8Pw2TM.js +1 -0
- package/packages/web/dist/client/assets/usecaseDiagram-POWQR4AR-Bg-CzKjl.js +328 -0
- package/packages/web/dist/client/assets/vennDiagram-UO4OBE2U-DBQKHXhK.js +34 -0
- package/packages/web/dist/client/assets/wardley-WFR3VGLG-B5aAsQ3F.js +1 -0
- package/packages/web/dist/client/assets/wardleyDiagram-VNRHLVJA-BKUQ1LK6.js +78 -0
- package/packages/web/dist/client/assets/xychartDiagram-PMCCYNJV-BI2sVbks.js +7 -0
- package/packages/web/dist/client/index.html +2 -2
- package/packages/web/dist/client/assets/core-C5fJJN75.js +0 -3
- package/packages/web/dist/client/assets/index-C5D7B_8d.js +0 -45
- package/packages/web/dist/client/assets/index-OVLzpES-.css +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cli as Argv } from "#core/shared/Cli";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const SURFACE_NAMES = ["web", "telegram"] as const;
|
|
4
4
|
|
|
5
5
|
export type SurfaceName = (typeof SURFACE_NAMES)[number];
|
|
6
6
|
|
|
@@ -8,11 +8,7 @@ function isSurfaceName(value: string | undefined): value is SurfaceName {
|
|
|
8
8
|
return SURFACE_NAMES.includes(value as SurfaceName);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Which surfaces this process should bring up. `--mode web` and `--mode
|
|
13
|
-
* telegram` are the single-surface spellings of `--surfaces`, so a Telegram-only
|
|
14
|
-
* install needs no port and a web-only one needs no token.
|
|
15
|
-
*/
|
|
11
|
+
/** `--mode web` and `--mode telegram` are the single-surface spellings of `--surfaces`. */
|
|
16
12
|
function parse(args: ReadonlyArray<string>): ReadonlyArray<SurfaceName> {
|
|
17
13
|
let requested: string | undefined;
|
|
18
14
|
let mode: string | undefined;
|
|
@@ -44,11 +40,6 @@ function parse(args: ReadonlyArray<string>): ReadonlyArray<SurfaceName> {
|
|
|
44
40
|
return SURFACE_NAMES.filter((name) => names.includes(name));
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
function format(names: ReadonlyArray<SurfaceName>): string {
|
|
48
|
-
return names.join(",");
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Whether the caller named the surfaces outright, rather than implying them by mode. */
|
|
52
43
|
function named(args: ReadonlyArray<string>): boolean {
|
|
53
44
|
return args.some(
|
|
54
45
|
(arg) => arg === "--surfaces" || arg.startsWith("--surfaces=")
|
|
@@ -63,4 +54,4 @@ function union(
|
|
|
63
54
|
);
|
|
64
55
|
}
|
|
65
56
|
|
|
66
|
-
export const Surfaces = { parse,
|
|
57
|
+
export const Surfaces = { parse, named, union };
|
|
@@ -15,7 +15,6 @@ function create(args: ReadonlyArray<string>, runtime: AgentRuntime): Surface {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/** `--print-config`, which resolves the bot's config the way a run would and stops there. */
|
|
19
18
|
async function printConfig(args: ReadonlyArray<string>): Promise<void> {
|
|
20
19
|
const config = await Config.load(Config.parseArgs(args));
|
|
21
20
|
console.log(
|
|
@@ -4,7 +4,6 @@ import { Surfaces } from "./Surfaces";
|
|
|
4
4
|
import { TelegramSurface } from "./TelegramSurface";
|
|
5
5
|
import { WebSurface } from "./WebSurface";
|
|
6
6
|
|
|
7
|
-
/** Every surface in this process shares one pi installation, and so one `auth.json`. */
|
|
8
7
|
export function build(args: ReadonlyArray<string>): ReadonlyArray<Surface> {
|
|
9
8
|
const runtime = new AgentRuntime();
|
|
10
9
|
return Surfaces.parse(args).map((name) =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DiffBase, LineSpan } from "./Diff";
|
|
2
2
|
|
|
3
|
-
/** A file already uploaded via `POST /upload
|
|
3
|
+
/** A file already uploaded via `POST /upload`. */
|
|
4
4
|
export type AttachmentRef = {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
};
|
|
@@ -13,15 +13,15 @@ export type Command =
|
|
|
13
13
|
readonly type: "attach";
|
|
14
14
|
readonly sessionId?: string;
|
|
15
15
|
readonly cwd?: string;
|
|
16
|
-
/** Copy model, thinking level and cwd from this session; ignored when `sessionId` is set or
|
|
16
|
+
/** Copy model, thinking level and cwd from this session; ignored when `sessionId` is set or it is not open. */
|
|
17
17
|
readonly like?: string;
|
|
18
18
|
readonly fromSeq: number;
|
|
19
|
-
/**
|
|
19
|
+
/** Absent means true. */
|
|
20
20
|
readonly attentive?: boolean;
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
22
|
+
/** An inattentive connection never marks a turn as read. */
|
|
23
23
|
| { readonly id: string; readonly type: "attention"; readonly value: boolean }
|
|
24
|
-
/** Sent
|
|
24
|
+
/** Sent mid-turn, it steers the running turn. */
|
|
25
25
|
| {
|
|
26
26
|
readonly id: string;
|
|
27
27
|
readonly type: "user_message";
|
|
@@ -30,7 +30,7 @@ export type Command =
|
|
|
30
30
|
readonly attachments?: readonly AttachmentRef[];
|
|
31
31
|
}
|
|
32
32
|
| { readonly id: string; readonly type: "cancel"; readonly sessionId: string }
|
|
33
|
-
/** Take back
|
|
33
|
+
/** Take back queued messages without stopping the turn; returned in `restored`. */
|
|
34
34
|
| {
|
|
35
35
|
readonly id: string;
|
|
36
36
|
readonly type: "dequeue";
|
|
@@ -56,102 +56,94 @@ export type Command =
|
|
|
56
56
|
readonly sessionId: string;
|
|
57
57
|
readonly value: string;
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
59
|
+
/** Works before any `attach`. */
|
|
60
60
|
| {
|
|
61
61
|
readonly id: string;
|
|
62
62
|
readonly type: "list_sessions";
|
|
63
|
-
/** Restrict to one working directory; omit for every session on disk. */
|
|
64
63
|
readonly cwd?: string;
|
|
65
64
|
readonly limit?: number;
|
|
66
|
-
/**
|
|
65
|
+
/** Max sessions per working directory. */
|
|
67
66
|
readonly perProject?: number;
|
|
68
|
-
/** List the archived sessions instead of the live ones. */
|
|
69
67
|
readonly archived?: boolean;
|
|
70
68
|
}
|
|
71
|
-
/**
|
|
69
|
+
/** An empty `query` warms the index and returns no hits. */
|
|
72
70
|
| {
|
|
73
71
|
readonly id: string;
|
|
74
72
|
readonly type: "search_sessions";
|
|
75
73
|
readonly query: string;
|
|
76
74
|
readonly limit?: number;
|
|
77
|
-
/** Restrict to one working directory; omit for every session on disk. */
|
|
78
75
|
readonly cwd?: string;
|
|
79
|
-
/** Omitted
|
|
76
|
+
/** Omitted searches everything; `false` excludes archived, `true` searches only archived. */
|
|
80
77
|
readonly archived?: boolean;
|
|
81
78
|
}
|
|
82
|
-
/**
|
|
79
|
+
/** Written as pi's `session_info`; `null` clears it. */
|
|
83
80
|
| {
|
|
84
81
|
readonly id: string;
|
|
85
82
|
readonly type: "set_session_name";
|
|
86
83
|
readonly sessionId: string;
|
|
87
84
|
readonly value: string | null;
|
|
88
85
|
}
|
|
89
|
-
/** pim's own overrides on a session: out of the default listing, or held unread until it is answered. */
|
|
90
86
|
| {
|
|
91
87
|
readonly id: string;
|
|
92
88
|
readonly type: "set_session_archived" | "set_session_unread";
|
|
93
89
|
readonly sessionId: string;
|
|
94
90
|
readonly value: boolean;
|
|
95
91
|
}
|
|
96
|
-
/**
|
|
97
|
-
* pim's own overrides on a working directory rather than a session: pinned
|
|
98
|
-
* sorts it above every other, expanded stands its sidebar group unfolded.
|
|
99
|
-
*/
|
|
100
92
|
| {
|
|
101
93
|
readonly id: string;
|
|
102
94
|
readonly type: "set_project_pinned" | "set_project_expanded";
|
|
103
95
|
readonly cwd: string;
|
|
104
96
|
readonly value: boolean;
|
|
105
97
|
}
|
|
106
|
-
/**
|
|
98
|
+
/** Display label only; `null` clears it. */
|
|
107
99
|
| {
|
|
108
100
|
readonly id: string;
|
|
109
101
|
readonly type: "set_project_label";
|
|
110
102
|
readonly cwd: string;
|
|
111
103
|
readonly value: string | null;
|
|
112
104
|
}
|
|
113
|
-
/**
|
|
105
|
+
/** The full pinned order; last write wins. */
|
|
114
106
|
| {
|
|
115
107
|
readonly id: string;
|
|
116
108
|
readonly type: "set_pin_order";
|
|
117
109
|
readonly order: readonly string[];
|
|
118
110
|
}
|
|
119
|
-
/**
|
|
111
|
+
/** Also returns the current model's thinking levels. */
|
|
120
112
|
| { readonly id: string; readonly type: "list_models" }
|
|
121
|
-
/**
|
|
113
|
+
/** Read against the connection's cwd when it has one. */
|
|
122
114
|
| { readonly id: string; readonly type: "list_extensions" }
|
|
123
|
-
/**
|
|
115
|
+
/** Sessions pick it up when they next rebuild their agent. */
|
|
124
116
|
| {
|
|
125
117
|
readonly id: string;
|
|
126
118
|
readonly type: "set_extension";
|
|
127
119
|
readonly extensionId: string;
|
|
128
120
|
readonly value: boolean;
|
|
129
121
|
}
|
|
130
|
-
/**
|
|
122
|
+
/** Errors when `path` is not a readable directory. */
|
|
131
123
|
| { readonly id: string; readonly type: "list_dirs"; readonly path: string }
|
|
132
|
-
/**
|
|
124
|
+
/** Parent must exist. */
|
|
133
125
|
| { readonly id: string; readonly type: "create_dir"; readonly path: string }
|
|
134
|
-
/**
|
|
126
|
+
/** `fetch` fetches the remote first, updating ahead/behind. */
|
|
135
127
|
| {
|
|
136
128
|
readonly id: string;
|
|
137
129
|
readonly type: "refresh_git";
|
|
138
130
|
readonly sessionId: string;
|
|
139
131
|
readonly fetch?: boolean;
|
|
140
132
|
}
|
|
141
|
-
/**
|
|
133
|
+
/** Trunk first, then most recent. */
|
|
142
134
|
| {
|
|
143
135
|
readonly id: string;
|
|
144
136
|
readonly type: "list_branches";
|
|
145
137
|
readonly sessionId: string;
|
|
146
138
|
}
|
|
147
|
-
/**
|
|
139
|
+
/** Files only, no hunks. Allowed mid-turn. */
|
|
148
140
|
| {
|
|
149
141
|
readonly id: string;
|
|
150
142
|
readonly type: "list_changes";
|
|
151
143
|
readonly sessionId: string;
|
|
152
144
|
readonly base: DiffBase;
|
|
153
145
|
}
|
|
154
|
-
/**
|
|
146
|
+
/** `context` defaults to 3. */
|
|
155
147
|
| {
|
|
156
148
|
readonly id: string;
|
|
157
149
|
readonly type: "file_diff";
|
|
@@ -160,7 +152,7 @@ export type Command =
|
|
|
160
152
|
readonly path: string;
|
|
161
153
|
readonly context?: number;
|
|
162
154
|
}
|
|
163
|
-
/**
|
|
155
|
+
/** Lines in the gaps between hunks. */
|
|
164
156
|
| {
|
|
165
157
|
readonly id: string;
|
|
166
158
|
readonly type: "read_lines";
|
|
@@ -169,29 +161,29 @@ export type Command =
|
|
|
169
161
|
readonly path: string;
|
|
170
162
|
readonly spans: readonly LineSpan[];
|
|
171
163
|
}
|
|
172
|
-
/** Refused while any session in the same
|
|
164
|
+
/** Refused while any session in the same cwd is mid-turn. */
|
|
173
165
|
| {
|
|
174
166
|
readonly id: string;
|
|
175
167
|
readonly type: "checkout";
|
|
176
168
|
readonly sessionId: string;
|
|
177
169
|
readonly branch: string;
|
|
178
170
|
}
|
|
179
|
-
/** `pull` is fast-forward only; `push`
|
|
171
|
+
/** `pull` is fast-forward only; `push` sets the upstream on first publish. */
|
|
180
172
|
| {
|
|
181
173
|
readonly id: string;
|
|
182
174
|
readonly type: "pull" | "push";
|
|
183
175
|
readonly sessionId: string;
|
|
184
176
|
}
|
|
185
|
-
/**
|
|
177
|
+
/** Commits exactly `paths`. Refused mid-turn, like `checkout`. */
|
|
186
178
|
| {
|
|
187
179
|
readonly id: string;
|
|
188
180
|
readonly type: "commit";
|
|
189
181
|
readonly sessionId: string;
|
|
190
182
|
readonly message: string;
|
|
191
|
-
/**
|
|
183
|
+
/** Include both names of a renamed file. */
|
|
192
184
|
readonly paths: readonly string[];
|
|
193
185
|
}
|
|
194
|
-
/**
|
|
186
|
+
/** `callId` is the parent's tool call; `sessionId` must be this connection's session. */
|
|
195
187
|
| {
|
|
196
188
|
readonly id: string;
|
|
197
189
|
readonly type: "watch_subagent";
|
|
@@ -199,15 +191,15 @@ export type Command =
|
|
|
199
191
|
readonly callId: string;
|
|
200
192
|
readonly fromSeq: number;
|
|
201
193
|
}
|
|
202
|
-
/**
|
|
194
|
+
/** Succeeds even if nothing is watched. */
|
|
203
195
|
| {
|
|
204
196
|
readonly id: string;
|
|
205
197
|
readonly type: "unwatch_subagent";
|
|
206
198
|
readonly callId: string;
|
|
207
199
|
}
|
|
208
|
-
/** Update
|
|
200
|
+
/** Update and restart; refused while any session is mid-turn unless `force`. */
|
|
209
201
|
| { readonly id: string; readonly type: "reload"; readonly force?: boolean }
|
|
210
|
-
/** Answers
|
|
202
|
+
/** Answers a `ui_request`; refused once it is settled. */
|
|
211
203
|
| {
|
|
212
204
|
readonly id: string;
|
|
213
205
|
readonly type: "ui_response";
|
|
@@ -227,13 +219,13 @@ export type CommandDraft = Command extends infer T
|
|
|
227
219
|
: never
|
|
228
220
|
: never;
|
|
229
221
|
|
|
230
|
-
/**
|
|
222
|
+
/** The `list_sessions` payload. */
|
|
231
223
|
export type SessionScope = Omit<
|
|
232
224
|
Extract<CommandDraft, { readonly type: "list_sessions" }>,
|
|
233
225
|
"type"
|
|
234
226
|
>;
|
|
235
227
|
|
|
236
|
-
/**
|
|
228
|
+
/** The `search_sessions` payload without `query`. */
|
|
237
229
|
export type SearchScope = Omit<
|
|
238
230
|
Extract<CommandDraft, { readonly type: "search_sessions" }>,
|
|
239
231
|
"type" | "query"
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
const PREFIX = "/image/";
|
|
2
2
|
|
|
3
|
-
/** Only the names a tool writes: a hex digest and one of the formats a provider takes. */
|
|
4
3
|
const NAME = /^[0-9a-f]{64}\.(?:png|jpg|gif|webp)$/;
|
|
5
4
|
|
|
6
|
-
/** Server-relative address of a picture a tool view names, the way an attachment's `url` is. */
|
|
7
5
|
function url(sha256: string, extension: string): string {
|
|
8
6
|
return `${PREFIX}${sha256}.${extension}`;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
/** Whether the gateway should route this path to its picture handler. */
|
|
12
9
|
function owns(pathname: string): boolean {
|
|
13
10
|
return pathname.startsWith(PREFIX);
|
|
14
11
|
}
|
|
15
12
|
|
|
16
|
-
/** The `<sha256>.<ext>` a
|
|
13
|
+
/** The `<sha256>.<ext>` a path addresses, or null when it is not a valid image name. */
|
|
17
14
|
function nameOf(pathname: string): string | null {
|
|
18
15
|
const name = pathname.slice(PREFIX.length);
|
|
19
16
|
return owns(pathname) && NAME.test(name) ? name : null;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
/** `GET /image/<sha256>.<ext
|
|
19
|
+
/** `GET /image/<sha256>.<ext>`. */
|
|
23
20
|
export const ImageRoute = { url, owns, nameOf };
|