@agimon-ai/po-runner 0.0.0-alpha.2 → 0.0.0-alpha.21
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/LICENSE +149 -21
- package/README.md +17 -17
- package/dist/ansiScrub.mjs +1 -2
- package/dist/apiContracts.cjs +1 -1
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.mjs +1 -1
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/{bashResult-bIVSzoj-.mjs → bashResult-BqDa7sbC.mjs} +10 -9
- package/dist/bashResult-BqDa7sbC.mjs.map +1 -0
- package/dist/{bashResult-DNgtahGR.cjs → bashResult-C2iKhHpD.cjs} +10 -9
- package/dist/bashResult-C2iKhHpD.cjs.map +1 -0
- package/dist/{bashRunService-CJ02XaAq.mjs → bashRunService-Cl3pYccr.mjs} +2 -2
- package/dist/bashRunService-Cl3pYccr.mjs.map +1 -0
- package/dist/{bashRunService-DyqxOSlx.cjs → bashRunService-DjOH5kye.cjs} +2 -2
- package/dist/bashRunService-DjOH5kye.cjs.map +1 -0
- package/dist/bashRunService.cjs +1 -1
- package/dist/bashRunService.d.mts +3 -3
- package/dist/bashRunService.mjs +1 -2
- package/dist/bashSchema.cjs +1 -1
- package/dist/bashSchema.mjs +1 -2
- package/dist/{bashTool-C-k7fmyh.mjs → bashTool-BvC3YOgG.mjs} +2 -2
- package/dist/{bashTool-C-k7fmyh.mjs.map → bashTool-BvC3YOgG.mjs.map} +1 -1
- package/dist/{bashTool-CdgtqVFD.cjs → bashTool-euL6zMDl.cjs} +2 -2
- package/dist/{bashTool-CdgtqVFD.cjs.map → bashTool-euL6zMDl.cjs.map} +1 -1
- package/dist/bashTool.cjs +3 -3
- package/dist/bashTool.d.mts +1 -1
- package/dist/bashTool.mjs +3 -3
- package/dist/bin/cli.cjs +6 -6
- package/dist/bin/cli.cjs.map +1 -1
- package/dist/bin/cli.mjs +7 -7
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/logSink.cjs +6 -6
- package/dist/bin/logSink.cjs.map +1 -1
- package/dist/bin/logSink.mjs +7 -7
- package/dist/bin/logSink.mjs.map +1 -1
- package/dist/bin/runnerHost.cjs +4 -4
- package/dist/bin/runnerHost.cjs.map +1 -1
- package/dist/bin/runnerHost.mjs +5 -5
- package/dist/bin/runnerHost.mjs.map +1 -1
- package/dist/{cliApp-Dj9nwaOv.cjs → cliApp-T8Fx_-1j.cjs} +6 -6
- package/dist/cliApp-T8Fx_-1j.cjs.map +1 -0
- package/dist/{cliApp-v8Z3rMCi.mjs → cliApp-q97eVh4E.mjs} +6 -6
- package/dist/cliApp-q97eVh4E.mjs.map +1 -0
- package/dist/cliApp.cjs +1 -1
- package/dist/cliApp.d.mts +1 -1
- package/dist/cliApp.mjs +1 -2
- package/dist/clock.mjs +1 -2
- package/dist/{compaction-4QSUsBxq.cjs → compaction-Cduebib_.cjs} +3 -3
- package/dist/compaction-Cduebib_.cjs.map +1 -0
- package/dist/{compaction-DCw80VZj.mjs → compaction-nNlE6e5I.mjs} +3 -3
- package/dist/compaction-nNlE6e5I.mjs.map +1 -0
- package/dist/compaction.cjs +1 -1
- package/dist/compaction.d.mts +1 -1
- package/dist/compaction.mjs +1 -2
- package/dist/config.cjs +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -2
- package/dist/extensions/mcp-ui.mjs.map +1 -1
- package/dist/extensions/mcp.cjs +8 -7
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.d.mts +1 -1
- package/dist/extensions/mcp.mjs +7 -6
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/native.mjs +1 -1
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +233 -119
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +2 -2
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +233 -119
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +88 -62
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{headless-BGYfIlNk.mjs → headless-DOlCixyf.mjs} +5 -5
- package/dist/headless-DOlCixyf.mjs.map +1 -0
- package/dist/{headless-CHUsBGhg.cjs → headless-Dko_yBiy.cjs} +5 -5
- package/dist/headless-Dko_yBiy.cjs.map +1 -0
- package/dist/{index-Dhi8asLH.d.mts → index--xF7DvsE.d.mts} +4 -4
- package/dist/{index-Dhi8asLH.d.mts.map → index--xF7DvsE.d.mts.map} +1 -1
- package/dist/{index-BZL7keVW.d.mts → index-BCCF1sGD.d.mts} +2 -2
- package/dist/{index-BZL7keVW.d.mts.map → index-BCCF1sGD.d.mts.map} +1 -1
- package/dist/{index-BwB_jTI9.d.mts → index-BzeXJk6V.d.mts} +5 -5
- package/dist/index-BzeXJk6V.d.mts.map +1 -0
- package/dist/{index-D9-IXax4.d.mts → index-C-IC35d9.d.mts} +2 -2
- package/dist/{index-D9-IXax4.d.mts.map → index-C-IC35d9.d.mts.map} +1 -1
- package/dist/{index-DBz0DxnL.d.mts → index-CzCF_OP9.d.mts} +3 -4
- package/dist/index-CzCF_OP9.d.mts.map +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/{launcher-BDm6-DiQ.mjs → launcher-CCYsFBM9.mjs} +3 -3
- package/dist/{launcher-BDm6-DiQ.mjs.map → launcher-CCYsFBM9.mjs.map} +1 -1
- package/dist/{launcher-SlyE8R3b.cjs → launcher-ZgDdyXpq.cjs} +8 -2
- package/dist/{launcher-SlyE8R3b.cjs.map → launcher-ZgDdyXpq.cjs.map} +1 -1
- package/dist/launcher.cjs +1 -1
- package/dist/launcher.d.mts +1 -1
- package/dist/launcher.mjs +1 -2
- package/dist/{lifeline-BZaQA0rm.mjs → lifeline-Bm-bHIjS.mjs} +6 -6
- package/dist/lifeline-Bm-bHIjS.mjs.map +1 -0
- package/dist/{lifeline-BuV_erib.cjs → lifeline-m7laIzIP.cjs} +6 -6
- package/dist/lifeline-m7laIzIP.cjs.map +1 -0
- package/dist/lifeline.cjs +1 -1
- package/dist/lifeline.d.mts +1 -1
- package/dist/lifeline.mjs +1 -1
- package/dist/{logFile-CNvepZh0.cjs → logFile-CnPKtxPy.cjs} +2 -2
- package/dist/{logFile-CNvepZh0.cjs.map → logFile-CnPKtxPy.cjs.map} +1 -1
- package/dist/{logFile-KKPbkC-a.mjs → logFile-XcDHBwu1.mjs} +2 -2
- package/dist/{logFile-KKPbkC-a.mjs.map → logFile-XcDHBwu1.mjs.map} +1 -1
- package/dist/logFile.cjs +1 -1
- package/dist/logFile.d.mts +1 -1
- package/dist/logFile.mjs +1 -2
- package/dist/{logReader-B6J7L7Ua.cjs → logReader-DHCK2BEr.cjs} +4 -4
- package/dist/{logReader-B6J7L7Ua.cjs.map → logReader-DHCK2BEr.cjs.map} +1 -1
- package/dist/{logReader-UfbDbwQl.mjs → logReader-mq9uVurh.mjs} +4 -4
- package/dist/{logReader-UfbDbwQl.mjs.map → logReader-mq9uVurh.mjs.map} +1 -1
- package/dist/logReader.cjs +1 -1
- package/dist/logReader.mjs +1 -2
- package/dist/processControl.mjs +1 -2
- package/dist/{ptyHost-DlQtTB8F.mjs → ptyHost-CwbLLr90.mjs} +2 -2
- package/dist/{ptyHost-DlQtTB8F.mjs.map → ptyHost-CwbLLr90.mjs.map} +1 -1
- package/dist/{ptyHost-MI2Z6WTG.cjs → ptyHost-D35hNmtd.cjs} +2 -2
- package/dist/{ptyHost-MI2Z6WTG.cjs.map → ptyHost-D35hNmtd.cjs.map} +1 -1
- package/dist/ptyHost.cjs +1 -1
- package/dist/ptyHost.mjs +1 -2
- package/dist/{ptySpawner-DEi1KOnd.mjs → ptySpawner-C375NJnj.mjs} +2 -2
- package/dist/ptySpawner-C375NJnj.mjs.map +1 -0
- package/dist/{ptySpawner-ijw0g5_T.cjs → ptySpawner-C39IzbRo.cjs} +2 -2
- package/dist/ptySpawner-C39IzbRo.cjs.map +1 -0
- package/dist/ptySpawner.cjs +1 -1
- package/dist/ptySpawner.d.mts +1 -1
- package/dist/ptySpawner.mjs +1 -2
- package/dist/{reconcile-DMeNSxwn.mjs → reconcile-5cZ11jSD.cjs} +12 -42
- package/dist/reconcile-5cZ11jSD.cjs.map +1 -0
- package/dist/{reconcile-BugwYFbV.cjs → reconcile-wNYQJZF-.mjs} +2 -62
- package/dist/reconcile-wNYQJZF-.mjs.map +1 -0
- package/dist/reconcile.cjs +1 -2
- package/dist/reconcile.d.mts +2 -9
- package/dist/reconcile.d.mts.map +1 -1
- package/dist/reconcile.mjs +1 -2
- package/dist/responseEnvelope.cjs +2 -2
- package/dist/responseEnvelope.d.mts +3 -3
- package/dist/responseEnvelope.mjs +2 -2
- package/dist/{rmuxBackend-DlxgqRZ1.cjs → rmuxBackend-Dh0CYVAL.cjs} +5 -5
- package/dist/rmuxBackend-Dh0CYVAL.cjs.map +1 -0
- package/dist/{rmuxBackend-DfyQwJrc.mjs → rmuxBackend-rjrVTG6K.mjs} +4 -4
- package/dist/rmuxBackend-rjrVTG6K.mjs.map +1 -0
- package/dist/rmuxBackend.cjs +1 -1
- package/dist/rmuxBackend.d.mts +1 -1
- package/dist/rmuxBackend.mjs +1 -2
- package/dist/{rtkProcessor-Bc4L4o_8.cjs → rtkProcessor-DSGbM-Cm.cjs} +4 -4
- package/dist/rtkProcessor-DSGbM-Cm.cjs.map +1 -0
- package/dist/{rtkProcessor-B9KPdyzr.mjs → rtkProcessor-Iw9gP5Xp.mjs} +3 -3
- package/dist/rtkProcessor-Iw9gP5Xp.mjs.map +1 -0
- package/dist/rtkProcessor.cjs +1 -1
- package/dist/rtkProcessor.d.mts +1 -1
- package/dist/rtkProcessor.mjs +1 -1
- package/dist/{runnerConfig-D2tGq5ZM.cjs → runnerConfig-BoLMinlx.cjs} +11 -11
- package/dist/runnerConfig-BoLMinlx.cjs.map +1 -0
- package/dist/{runnerConfig-BjtulXBI.d.mts → runnerConfig-DuWL6TJx.d.mts} +10 -10
- package/dist/{runnerConfig-BjtulXBI.d.mts.map → runnerConfig-DuWL6TJx.d.mts.map} +1 -1
- package/dist/{runnerConfig-BQBlVAXn.mjs → runnerConfig-XXMq4VQA.mjs} +11 -11
- package/dist/runnerConfig-XXMq4VQA.mjs.map +1 -0
- package/dist/{runnerDependencies-DruByBGS.mjs → runnerDependencies-7h_cxOva.mjs} +17 -17
- package/dist/runnerDependencies-7h_cxOva.mjs.map +1 -0
- package/dist/{runnerDependencies-KMZigIxB.cjs → runnerDependencies-DSun3xO-.cjs} +17 -17
- package/dist/runnerDependencies-DSun3xO-.cjs.map +1 -0
- package/dist/runnerDependencies.cjs +1 -1
- package/dist/runnerDependencies.d.mts +1 -1
- package/dist/runnerDependencies.mjs +1 -2
- package/dist/runnerNamer.d.mts +1 -1
- package/dist/runnerNamer.mjs +1 -2
- package/dist/{runnerPaths-BTEuzxw0.cjs → runnerPaths-B41rMOY6.cjs} +20 -38
- package/dist/runnerPaths-B41rMOY6.cjs.map +1 -0
- package/dist/{runnerPaths-B_dAAeco.mjs → runnerPaths-Dibbvyx_.mjs} +20 -38
- package/dist/runnerPaths-Dibbvyx_.mjs.map +1 -0
- package/dist/runnerPaths.cjs +1 -1
- package/dist/runnerPaths.d.mts +5 -7
- package/dist/runnerPaths.d.mts.map +1 -1
- package/dist/runnerPaths.mjs +1 -2
- package/dist/{runnerRegistry-CeOHEjBv.mjs → runnerRegistry-BgaR5O86.mjs} +12 -11
- package/dist/runnerRegistry-BgaR5O86.mjs.map +1 -0
- package/dist/{runnerRegistry-CtJiD02R.d.mts → runnerRegistry-V-Ocaf4N.d.mts} +1 -3
- package/dist/{runnerRegistry-CtJiD02R.d.mts.map → runnerRegistry-V-Ocaf4N.d.mts.map} +1 -1
- package/dist/{runnerRegistry-BmkZTJHi.cjs → runnerRegistry-dQYlMSpQ.cjs} +23 -10
- package/dist/runnerRegistry-dQYlMSpQ.cjs.map +1 -0
- package/dist/runnerRegistry.cjs +1 -1
- package/dist/runnerRegistry.d.mts +2 -2
- package/dist/runnerRegistry.mjs +1 -2
- package/dist/services/lifeline/client.cjs +2 -2
- package/dist/services/lifeline/client.cjs.map +1 -1
- package/dist/services/lifeline/client.d.mts +1 -1
- package/dist/services/lifeline/client.mjs +2 -2
- package/dist/services/lifeline/client.mjs.map +1 -1
- package/dist/{session-Chsb_Nh2.mjs → session-BKYnH4R6.mjs} +2 -2
- package/dist/{session-Chsb_Nh2.mjs.map → session-BKYnH4R6.mjs.map} +1 -1
- package/dist/{session-BC43uEyG.cjs → session-BvqzhXZY.cjs} +2 -2
- package/dist/{session-BC43uEyG.cjs.map → session-BvqzhXZY.cjs.map} +1 -1
- package/dist/session.cjs +1 -1
- package/dist/session.mjs +1 -1
- package/dist/spawner.mjs +1 -2
- package/dist/{type-C31e1gla.d.mts → type-Do0YxwVQ.d.mts} +4 -4
- package/dist/{type-C31e1gla.d.mts.map → type-Do0YxwVQ.d.mts.map} +1 -1
- package/dist/{type-BXM03qSw.d.mts → type-DwMZoINK.d.mts} +8 -8
- package/dist/{type-BXM03qSw.d.mts.map → type-DwMZoINK.d.mts.map} +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +31 -34
- package/skills/{doom-runner → po-runner}/SKILL.md +15 -15
- package/src/prompts/po-use-runner/SKILL.md +11 -11
- package/dist/bashResult-DNgtahGR.cjs.map +0 -1
- package/dist/bashResult-bIVSzoj-.mjs.map +0 -1
- package/dist/bashRunService-CJ02XaAq.mjs.map +0 -1
- package/dist/bashRunService-DyqxOSlx.cjs.map +0 -1
- package/dist/cliApp-Dj9nwaOv.cjs.map +0 -1
- package/dist/cliApp-v8Z3rMCi.mjs.map +0 -1
- package/dist/compaction-4QSUsBxq.cjs.map +0 -1
- package/dist/compaction-DCw80VZj.mjs.map +0 -1
- package/dist/headless-BGYfIlNk.mjs.map +0 -1
- package/dist/headless-CHUsBGhg.cjs.map +0 -1
- package/dist/index-BwB_jTI9.d.mts.map +0 -1
- package/dist/index-DBz0DxnL.d.mts.map +0 -1
- package/dist/lifeline-BZaQA0rm.mjs.map +0 -1
- package/dist/lifeline-BuV_erib.cjs.map +0 -1
- package/dist/ptySpawner-DEi1KOnd.mjs.map +0 -1
- package/dist/ptySpawner-ijw0g5_T.cjs.map +0 -1
- package/dist/reconcile-BugwYFbV.cjs.map +0 -1
- package/dist/reconcile-DMeNSxwn.mjs.map +0 -1
- package/dist/rmuxBackend-DfyQwJrc.mjs.map +0 -1
- package/dist/rmuxBackend-DlxgqRZ1.cjs.map +0 -1
- package/dist/rtkProcessor-B9KPdyzr.mjs.map +0 -1
- package/dist/rtkProcessor-Bc4L4o_8.cjs.map +0 -1
- package/dist/runnerConfig-BQBlVAXn.mjs.map +0 -1
- package/dist/runnerConfig-D2tGq5ZM.cjs.map +0 -1
- package/dist/runnerDependencies-DruByBGS.mjs.map +0 -1
- package/dist/runnerDependencies-KMZigIxB.cjs.map +0 -1
- package/dist/runnerPaths-BTEuzxw0.cjs.map +0 -1
- package/dist/runnerPaths-B_dAAeco.mjs.map +0 -1
- package/dist/runnerRegistry-BmkZTJHi.cjs.map +0 -1
- package/dist/runnerRegistry-CeOHEjBv.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
2
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
|
|
6
|
+
Licensor: Agimon Pty Ltd
|
|
7
|
+
Licensed Work: Po, the software in the Po source repository and the
|
|
8
|
+
packages released from it, in each version released by
|
|
9
|
+
the Licensor.
|
|
10
|
+
The Licensed Work is (c) 2026 Agimon Pty Ltd.
|
|
11
|
+
Material identified as third-party in the "Third-party
|
|
12
|
+
components" section at the end of this file or in a
|
|
13
|
+
NOTICE file, and any package or directory whose own
|
|
14
|
+
license file grants a different license, is not part of
|
|
15
|
+
the Licensed Work and remains under its own license.
|
|
16
|
+
Additional Use Grant: You may make production use of the Licensed Work if
|
|
17
|
+
your use is Eligible Use. "Eligible Use" is production use that falls
|
|
18
|
+
within at least one of the following:
|
|
19
|
+
|
|
20
|
+
(a) Personal Use. Use by an individual for their own personal purposes,
|
|
21
|
+
and not on behalf of, or for the benefit of, an employer, client, or
|
|
22
|
+
other Organization. Use by an individual in the course of employment
|
|
23
|
+
or engagement by an Organization is use by that Organization.
|
|
24
|
+
|
|
25
|
+
(b) Small Organization Use. Use by or on behalf of an Organization whose
|
|
26
|
+
Annual Revenue is less than USD 1,000,000.
|
|
27
|
+
|
|
28
|
+
(c) Non-profit, Education and Research Use. Use, regardless of Annual
|
|
29
|
+
Revenue, by (i) an Organization registered or recognized as a
|
|
30
|
+
non-profit or charitable organization under the laws of its
|
|
31
|
+
jurisdiction, for its non-profit purposes; (ii) an accredited school,
|
|
32
|
+
college, or university, for teaching, learning, or academic research;
|
|
33
|
+
or (iii) a publicly funded research institution, for its research.
|
|
34
|
+
|
|
35
|
+
(d) Service Provider Use. Use by a consultant, contractor, agency, or other
|
|
36
|
+
service provider, regardless of its own Annual Revenue, solely to
|
|
37
|
+
build, deploy, host, operate, or support the Licensed Work for a client
|
|
38
|
+
whose own use would be Eligible Use under (a), (b), or (c). A service
|
|
39
|
+
provider's use for its own purposes is Eligible Use only if the service
|
|
40
|
+
provider itself qualifies under (b) or (c).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Hosted services. Offering the Licensed Work to third parties as a hosted
|
|
44
|
+
or managed service whose primary value is the Licensed Work is Eligible
|
|
45
|
+
Use only if each such third party's own use would be Eligible Use.
|
|
46
|
+
|
|
47
|
+
Definitions. "Organization" means any company, partnership, sole
|
|
48
|
+
proprietorship, trust, association, government body, or other entity, and
|
|
49
|
+
includes an individual acting in a business or professional capacity.
|
|
50
|
+
"Affiliate" means any entity that directly or indirectly controls, is
|
|
51
|
+
controlled by, or is under common control with an Organization, where
|
|
52
|
+
"control" means ownership of more than 50% of the voting interests of an
|
|
53
|
+
entity or the power to direct its management and policies by contract or
|
|
54
|
+
otherwise. "Annual Revenue" means the total gross revenue of an
|
|
55
|
+
Organization and all of its Affiliates combined, from all sources and
|
|
56
|
+
whether or not related to the Licensed Work, for its most recently
|
|
57
|
+
completed fiscal year, or, if it has not completed a fiscal year, for the
|
|
58
|
+
twelve months before the use (or since its formation, if shorter),
|
|
59
|
+
converted into US dollars at the average exchange rate for that period.
|
|
60
|
+
Proceeds of equity or debt financing are not revenue.
|
|
61
|
+
|
|
62
|
+
Threshold. If an Organization stops qualifying under (b), its existing
|
|
63
|
+
production use remains Eligible Use for 90 days after it stops
|
|
64
|
+
qualifying, after which it must obtain a commercial license or stop
|
|
65
|
+
production use. Use that was Eligible Use when it occurred never requires
|
|
66
|
+
a commercial license after the fact.
|
|
67
|
+
Change Date: Four years from the date a version of the Licensed Work
|
|
68
|
+
is first publicly released by the Licensor.
|
|
69
|
+
Change License: Apache License, Version 2.0
|
|
70
|
+
|
|
71
|
+
For information about alternative licensing arrangements for the Licensed
|
|
72
|
+
Work, please visit: https://agimon.ai/licensing
|
|
73
|
+
|
|
74
|
+
Notice
|
|
75
|
+
|
|
76
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
77
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
78
|
+
under an Open Source License, as stated in this License.
|
|
79
|
+
|
|
80
|
+
-----------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
Business Source License 1.1
|
|
83
|
+
|
|
84
|
+
Terms
|
|
85
|
+
|
|
86
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
87
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
88
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
89
|
+
production use.
|
|
90
|
+
|
|
91
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
92
|
+
available distribution of a specific version of the Licensed Work under this
|
|
93
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
94
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
95
|
+
above terminate.
|
|
96
|
+
|
|
97
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
98
|
+
currently in effect as described in this License, you must purchase a
|
|
99
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
100
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
101
|
+
|
|
102
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
103
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
104
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
105
|
+
for each version of the Licensed Work released by Licensor.
|
|
106
|
+
|
|
107
|
+
You must conspicuously display this License on each original or modified copy
|
|
108
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
109
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
110
|
+
License apply to your use of that work.
|
|
111
|
+
|
|
112
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
113
|
+
terminate your rights under this License for the current and all other
|
|
114
|
+
versions of the Licensed Work.
|
|
115
|
+
|
|
116
|
+
This License does not grant you any right in any trademark or logo of
|
|
117
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
118
|
+
Licensor as expressly required by this License).
|
|
119
|
+
|
|
120
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
121
|
+
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
122
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
123
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
124
|
+
TITLE.
|
|
125
|
+
|
|
126
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
|
127
|
+
your works, and to refer to it using the trademark “Business Source License”,
|
|
128
|
+
as long as you comply with the Covenants of Licensor below.
|
|
129
|
+
|
|
130
|
+
Covenants of Licensor
|
|
131
|
+
|
|
132
|
+
In consideration of the right to use this License’s text and the “Business
|
|
133
|
+
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
134
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
135
|
+
|
|
136
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
137
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
138
|
+
where “compatible” means that software provided under the Change License can
|
|
139
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
140
|
+
later version. Licensor may specify additional Change Licenses without
|
|
141
|
+
limitation.
|
|
142
|
+
|
|
143
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
144
|
+
impose any additional restriction on the right granted in this License, as
|
|
145
|
+
the Additional Use Grant; or (b) insert the text “None”.
|
|
146
|
+
|
|
147
|
+
3. To specify a Change Date.
|
|
148
|
+
|
|
149
|
+
4. Not to modify this License in any other way.
|
package/README.md
CHANGED
|
@@ -29,11 +29,11 @@ Panes come from the first backend that answers: bundled RMUX, then `rmux` on PAT
|
|
|
29
29
|
PATH. Only when none is available does a non-interactive command fall back to a supervised
|
|
30
30
|
subprocess, and interactive commands need one of them. A tmux-backed run is supervised by the same
|
|
31
31
|
host process as an RMUX one, so exit metadata and logs behave the same; its session names carry a
|
|
32
|
-
`
|
|
32
|
+
`po-tmux-` prefix rather than `po-runner-`.
|
|
33
33
|
|
|
34
34
|
## Install
|
|
35
35
|
|
|
36
|
-
`po init`
|
|
36
|
+
`po init` include Runner in `default.packages` in `.po/modes.yaml`. Move
|
|
37
37
|
it to a named layer to enable it only in selected major modes.
|
|
38
38
|
|
|
39
39
|
## Use the `bash` tool
|
|
@@ -63,15 +63,15 @@ also returns bounded raw output with a warning and does not change the command e
|
|
|
63
63
|
|
|
64
64
|
## Inspect and control runs
|
|
65
65
|
|
|
66
|
-
The `
|
|
66
|
+
The `po-runner` CLI supports:
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
po-runner list
|
|
70
|
+
po-runner status <runner-id>
|
|
71
|
+
po-runner logs <runner-id>
|
|
72
|
+
po-runner input <runner-id> --text "y" --enter
|
|
73
|
+
po-runner stop <runner-id>
|
|
74
|
+
po-runner stop-all
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
The `input` command requires a running interactive process backed by RMUX or tmux.
|
|
@@ -83,7 +83,7 @@ Stop runs that are no longer required.
|
|
|
83
83
|
By default, session-scoped logs and registry data live under:
|
|
84
84
|
|
|
85
85
|
```text
|
|
86
|
-
~/.po/agent/
|
|
86
|
+
~/.po/agent/po-runner/<session>/
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
Logs remain complete until TTL cleanup and are eligible for cleanup after seven days by default. The
|
|
@@ -109,7 +109,7 @@ Compiling 1200 modules...
|
|
|
109
109
|
compiled src/module-599.ts
|
|
110
110
|
Build succeeded in 12.4s
|
|
111
111
|
exit status 0
|
|
112
|
-
Full log: /path/to/run.log (17.0 KB, 604 lines); inspect with
|
|
112
|
+
Full log: /path/to/run.log (17.0 KB, 604 lines); inspect with po-runner logs run-a
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
Three ceilings apply and whichever binds first wins: bytes, lines, and tokens. Tokens are there
|
|
@@ -123,8 +123,8 @@ estimator models how BPE behaves, with punctuation forcing boundaries, natural w
|
|
|
123
123
|
letter-digit runs expensive. Its worst error against `gpt-tokenizer` is a factor of about 1.46
|
|
124
124
|
either way, which is why the byte ceiling stays behind it as the hard bound.
|
|
125
125
|
|
|
126
|
-
`
|
|
127
|
-
`
|
|
126
|
+
`PO_RUNNER_RESULT_MAX_BYTES`, `PO_RUNNER_RESULT_MAX_TOKENS`, and their
|
|
127
|
+
`PO_RUNNER_SUCCESS_*` counterparts move these for one invocation. A pragma overrides all of
|
|
128
128
|
them, which is how one noisy successful command can still ask for the wider result. Raising only
|
|
129
129
|
`maxResultBytes` will not help when the token ceiling is the one binding.
|
|
130
130
|
|
|
@@ -151,7 +151,7 @@ One command that needs a wider result can say so on its first line. The pragma i
|
|
|
151
151
|
so it stays harmless to the command itself:
|
|
152
152
|
|
|
153
153
|
```bash
|
|
154
|
-
# @
|
|
154
|
+
# @po: {"maxResultBytes": 32768, "maxResultTokens": 8192, "maxResultLines": 300}
|
|
155
155
|
pnpm build
|
|
156
156
|
```
|
|
157
157
|
|
|
@@ -186,7 +186,7 @@ retention accordingly.
|
|
|
186
186
|
|
|
187
187
|
The headless Po server shares one heavy-job queue across its sessions. Known
|
|
188
188
|
noninteractive build, test, lint, and typecheck commands acquire a slot before
|
|
189
|
-
launching. The default is two concurrent jobs; set `
|
|
189
|
+
launching. The default is two concurrent jobs; set `PO_RUNNER_MAX_HEAVY_JOBS`
|
|
190
190
|
to a positive integer in the server's environment to change it. The waiting queue
|
|
191
191
|
is bounded to 128 jobs. Cancellation removes queued work without launching it.
|
|
192
192
|
|
|
@@ -246,7 +246,7 @@ Maintained by [Agimon](https://agimon.ai/about).
|
|
|
246
246
|
|
|
247
247
|
## License
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
|
|
250
250
|
|
|
251
251
|
## Extension lifecycle and source layout
|
|
252
252
|
|
|
@@ -254,4 +254,4 @@ Public capabilities use flat kebab-case subpaths such as `runner-dependencies`,
|
|
|
254
254
|
|
|
255
255
|
### Native session ownership
|
|
256
256
|
|
|
257
|
-
The Po server
|
|
257
|
+
The Po server plugin owns runner startup, history retention, background completion notifications, and successful-compaction recovery. The standalone `po-runner` command remains available. Runner project settings retain the existing headless bridge's trusted-project assumption, validation, and environment-over-project precedence. Optional runner activity toggles do not restart the retained supervisor.
|
package/dist/ansiScrub.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { collapseCarriageReturns, scrubTerminalOutput, scrubTerminalOutputToPlainText, stripAnsi, stripAnsiKeepingColour };
|
|
1
|
+
export { t as collapseCarriageReturns, n as scrubTerminalOutput, r as scrubTerminalOutputToPlainText, i as stripAnsi, a as stripAnsiKeepingColour } from "./ansiScrub-CsqTSaVT.mjs";
|
package/dist/apiContracts.cjs
CHANGED
|
@@ -147,7 +147,7 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
|
147
147
|
sockets: ["global", "workspace"].map((scope) => ({
|
|
148
148
|
id: "runner.channel",
|
|
149
149
|
scope,
|
|
150
|
-
service: "po.hub
|
|
150
|
+
service: "po.hub",
|
|
151
151
|
member: "runner_runs",
|
|
152
152
|
kind: "channel",
|
|
153
153
|
direction: "server-to-client",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.cjs","names":["Type","defineApiContract","jsonApiResponses"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nconst Run = Type.Object({\n id: S,\n name: S,\n pid: N,\n command: S,\n cwd: S,\n interactive: B,\n backend: literals(['rmux', 'tmux', 'native']),\n state: literals(['running', 'completed']),\n promoted: B,\n startedAt: S,\n logPath: S,\n exit: O(\n Type.Object({\n reason: literals(['completed', 'failed', 'signaled', 'stopped', 'timed_out', 'launcher_error', 'backend_lost']),\n code: Type.Union([N, Type.Null()]),\n signal: Type.Union([S, Type.Null()]),\n terminationReason: O(\n literals([\n 'timeout',\n 'user_stop',\n 'request_cancelled',\n 'parent_session_cleanup',\n 'owner_lost',\n 'external_signal',\n ]),\n ),\n stopReason: O(S),\n finishedAt: S,\n }),\n ),\n});\nexport const RunnerPayloadSchema = Type.Object({ runs: Type.Array(Run) });\nexport const RunnerLogSchema = Type.Object({\n runId: S,\n running: B,\n text: S,\n lineCount: N,\n totalLines: N,\n fileSize: N,\n completeBytes: N,\n path: S,\n exists: B,\n lineNumbers: O(Type.Array(N)),\n});\nexport const RunnerAppendSchema = Type.Object({ lines: Type.Array(S), offset: O(N), ended: O(B) });\nexport const RunnerScreenSchema = Type.Object({ chunk: S, offset: O(N), ended: O(B) });\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: [\n {\n id: 'runner.log',\n scope: 'session',\n basePath: 'runner',\n path: '/runners/{runId}/log',\n method: 'GET',\n authentication: 'owner',\n description: 'Read a runner log tail or literal substring search.',\n parameters: ['lines', 'grep', 'ignoreCase', 'contextLines'].map((name) => ({\n name,\n in: 'query',\n required: false,\n schema: S,\n })),\n responses: jsonApiResponses(RunnerLogSchema),\n },\n ...(['log', 'screen'] as const).map((kind) => ({\n id: `runner.${kind}.stream`,\n scope: 'session' as const,\n basePath: 'runner',\n path: `/runners/{runId}/${kind}/stream`,\n method: 'GET' as const,\n authentication: 'owner' as const,\n description: `Follow runner ${kind}. SSE data is JSON; ping events carry empty data.`,\n parameters: [{ name: 'from', in: 'query' as const, required: false, schema: N }],\n responses: {\n '200': {\n description: 'Event stream.',\n contentType: 'text/event-stream',\n schema: S,\n events: {\n [kind === 'log' ? 'append' : 'screen']: kind === 'log' ? RunnerAppendSchema : RunnerScreenSchema,\n ping: Type.Literal(''),\n },\n },\n '404': { description: 'Runner unavailable.', schema: Type.Object({ error: S }) },\n },\n })),\n {\n id: 'runner.input',\n scope: 'session',\n basePath: 'runner',\n path: '/runners/{runId}/screen/input',\n method: 'POST',\n authentication: 'owner',\n description: 'Send text to an interactive runner.',\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Object({ text: Type.String({ minLength: 1 }) }),\n },\n responses: jsonApiResponses(Type.Object({ delivered: Type.Literal(true) })),\n },\n ],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'runner.channel',\n scope,\n service: 'po.hub
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["Type","defineApiContract","jsonApiResponses"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nconst Run = Type.Object({\n id: S,\n name: S,\n pid: N,\n command: S,\n cwd: S,\n interactive: B,\n backend: literals(['rmux', 'tmux', 'native']),\n state: literals(['running', 'completed']),\n promoted: B,\n startedAt: S,\n logPath: S,\n exit: O(\n Type.Object({\n reason: literals(['completed', 'failed', 'signaled', 'stopped', 'timed_out', 'launcher_error', 'backend_lost']),\n code: Type.Union([N, Type.Null()]),\n signal: Type.Union([S, Type.Null()]),\n terminationReason: O(\n literals([\n 'timeout',\n 'user_stop',\n 'request_cancelled',\n 'parent_session_cleanup',\n 'owner_lost',\n 'external_signal',\n ]),\n ),\n stopReason: O(S),\n finishedAt: S,\n }),\n ),\n});\nexport const RunnerPayloadSchema = Type.Object({ runs: Type.Array(Run) });\nexport const RunnerLogSchema = Type.Object({\n runId: S,\n running: B,\n text: S,\n lineCount: N,\n totalLines: N,\n fileSize: N,\n completeBytes: N,\n path: S,\n exists: B,\n lineNumbers: O(Type.Array(N)),\n});\nexport const RunnerAppendSchema = Type.Object({ lines: Type.Array(S), offset: O(N), ended: O(B) });\nexport const RunnerScreenSchema = Type.Object({ chunk: S, offset: O(N), ended: O(B) });\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: [\n {\n id: 'runner.log',\n scope: 'session',\n basePath: 'runner',\n path: '/runners/{runId}/log',\n method: 'GET',\n authentication: 'owner',\n description: 'Read a runner log tail or literal substring search.',\n parameters: ['lines', 'grep', 'ignoreCase', 'contextLines'].map((name) => ({\n name,\n in: 'query',\n required: false,\n schema: S,\n })),\n responses: jsonApiResponses(RunnerLogSchema),\n },\n ...(['log', 'screen'] as const).map((kind) => ({\n id: `runner.${kind}.stream`,\n scope: 'session' as const,\n basePath: 'runner',\n path: `/runners/{runId}/${kind}/stream`,\n method: 'GET' as const,\n authentication: 'owner' as const,\n description: `Follow runner ${kind}. SSE data is JSON; ping events carry empty data.`,\n parameters: [{ name: 'from', in: 'query' as const, required: false, schema: N }],\n responses: {\n '200': {\n description: 'Event stream.',\n contentType: 'text/event-stream',\n schema: S,\n events: {\n [kind === 'log' ? 'append' : 'screen']: kind === 'log' ? RunnerAppendSchema : RunnerScreenSchema,\n ping: Type.Literal(''),\n },\n },\n '404': { description: 'Runner unavailable.', schema: Type.Object({ error: S }) },\n },\n })),\n {\n id: 'runner.input',\n scope: 'session',\n basePath: 'runner',\n path: '/runners/{runId}/screen/input',\n method: 'POST',\n authentication: 'owner',\n description: 'Send text to an interactive runner.',\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Object({ text: Type.String({ minLength: 1 }) }),\n },\n responses: jsonApiResponses(Type.Object({ delivered: Type.Literal(true) })),\n },\n ],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'runner.channel',\n scope,\n service: 'po.hub',\n member: 'runner_runs',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Runner channel payload in the hub frame payload property.',\n input: RunnerPayloadSchema,\n })),\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK,QAAQ;AACvB,MAAM,IAAI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AA,KAAK,OAAO,EAAE,WAAWA,QAAAA,KAAK,QAAQ,IAAI,EAAE,CAAC,CAAC;EAC5E;CACF;CACA,SAAU,CAAC,UAAU,WAAW,CAAC,CAAW,KAAK,WAAW;EAC1D,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO;CACT,EAAE;AACJ,CAAC"}
|
package/dist/apiContracts.mjs
CHANGED
|
@@ -143,7 +143,7 @@ const apiContracts = defineApiContract({
|
|
|
143
143
|
sockets: ["global", "workspace"].map((scope) => ({
|
|
144
144
|
id: "runner.channel",
|
|
145
145
|
scope,
|
|
146
|
-
service: "po.hub
|
|
146
|
+
service: "po.hub",
|
|
147
147
|
member: "runner_runs",
|
|
148
148
|
kind: "channel",
|
|
149
149
|
direction: "server-to-client",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nconst Run = Type.Object({\n id: S,\n name: S,\n pid: N,\n command: S,\n cwd: S,\n interactive: B,\n backend: literals(['rmux', 'tmux', 'native']),\n state: literals(['running', 'completed']),\n promoted: B,\n startedAt: S,\n logPath: S,\n exit: O(\n Type.Object({\n reason: literals(['completed', 'failed', 'signaled', 'stopped', 'timed_out', 'launcher_error', 'backend_lost']),\n code: Type.Union([N, Type.Null()]),\n signal: Type.Union([S, Type.Null()]),\n terminationReason: O(\n literals([\n 'timeout',\n 'user_stop',\n 'request_cancelled',\n 'parent_session_cleanup',\n 'owner_lost',\n 'external_signal',\n ]),\n ),\n stopReason: O(S),\n finishedAt: S,\n }),\n ),\n});\nexport const RunnerPayloadSchema = Type.Object({ runs: Type.Array(Run) });\nexport const RunnerLogSchema = Type.Object({\n runId: S,\n running: B,\n text: S,\n lineCount: N,\n totalLines: N,\n fileSize: N,\n completeBytes: N,\n path: S,\n exists: B,\n lineNumbers: O(Type.Array(N)),\n});\nexport const RunnerAppendSchema = Type.Object({ lines: Type.Array(S), offset: O(N), ended: O(B) });\nexport const RunnerScreenSchema = Type.Object({ chunk: S, offset: O(N), ended: O(B) });\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: [\n {\n id: 'runner.log',\n scope: 'session',\n basePath: 'runner',\n path: '/runners/{runId}/log',\n method: 'GET',\n authentication: 'owner',\n description: 'Read a runner log tail or literal substring search.',\n parameters: ['lines', 'grep', 'ignoreCase', 'contextLines'].map((name) => ({\n name,\n in: 'query',\n required: false,\n schema: S,\n })),\n responses: jsonApiResponses(RunnerLogSchema),\n },\n ...(['log', 'screen'] as const).map((kind) => ({\n id: `runner.${kind}.stream`,\n scope: 'session' as const,\n basePath: 'runner',\n path: `/runners/{runId}/${kind}/stream`,\n method: 'GET' as const,\n authentication: 'owner' as const,\n description: `Follow runner ${kind}. SSE data is JSON; ping events carry empty data.`,\n parameters: [{ name: 'from', in: 'query' as const, required: false, schema: N }],\n responses: {\n '200': {\n description: 'Event stream.',\n contentType: 'text/event-stream',\n schema: S,\n events: {\n [kind === 'log' ? 'append' : 'screen']: kind === 'log' ? RunnerAppendSchema : RunnerScreenSchema,\n ping: Type.Literal(''),\n },\n },\n '404': { description: 'Runner unavailable.', schema: Type.Object({ error: S }) },\n },\n })),\n {\n id: 'runner.input',\n scope: 'session',\n basePath: 'runner',\n path: '/runners/{runId}/screen/input',\n method: 'POST',\n authentication: 'owner',\n description: 'Send text to an interactive runner.',\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Object({ text: Type.String({ minLength: 1 }) }),\n },\n responses: jsonApiResponses(Type.Object({ delivered: Type.Literal(true) })),\n },\n ],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'runner.channel',\n scope,\n service: 'po.hub
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nconst Run = Type.Object({\n id: S,\n name: S,\n pid: N,\n command: S,\n cwd: S,\n interactive: B,\n backend: literals(['rmux', 'tmux', 'native']),\n state: literals(['running', 'completed']),\n promoted: B,\n startedAt: S,\n logPath: S,\n exit: O(\n Type.Object({\n reason: literals(['completed', 'failed', 'signaled', 'stopped', 'timed_out', 'launcher_error', 'backend_lost']),\n code: Type.Union([N, Type.Null()]),\n signal: Type.Union([S, Type.Null()]),\n terminationReason: O(\n literals([\n 'timeout',\n 'user_stop',\n 'request_cancelled',\n 'parent_session_cleanup',\n 'owner_lost',\n 'external_signal',\n ]),\n ),\n stopReason: O(S),\n finishedAt: S,\n }),\n ),\n});\nexport const RunnerPayloadSchema = Type.Object({ runs: Type.Array(Run) });\nexport const RunnerLogSchema = Type.Object({\n runId: S,\n running: B,\n text: S,\n lineCount: N,\n totalLines: N,\n fileSize: N,\n completeBytes: N,\n path: S,\n exists: B,\n lineNumbers: O(Type.Array(N)),\n});\nexport const RunnerAppendSchema = Type.Object({ lines: Type.Array(S), offset: O(N), ended: O(B) });\nexport const RunnerScreenSchema = Type.Object({ chunk: S, offset: O(N), ended: O(B) });\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: [\n {\n id: 'runner.log',\n scope: 'session',\n basePath: 'runner',\n path: '/runners/{runId}/log',\n method: 'GET',\n authentication: 'owner',\n description: 'Read a runner log tail or literal substring search.',\n parameters: ['lines', 'grep', 'ignoreCase', 'contextLines'].map((name) => ({\n name,\n in: 'query',\n required: false,\n schema: S,\n })),\n responses: jsonApiResponses(RunnerLogSchema),\n },\n ...(['log', 'screen'] as const).map((kind) => ({\n id: `runner.${kind}.stream`,\n scope: 'session' as const,\n basePath: 'runner',\n path: `/runners/{runId}/${kind}/stream`,\n method: 'GET' as const,\n authentication: 'owner' as const,\n description: `Follow runner ${kind}. SSE data is JSON; ping events carry empty data.`,\n parameters: [{ name: 'from', in: 'query' as const, required: false, schema: N }],\n responses: {\n '200': {\n description: 'Event stream.',\n contentType: 'text/event-stream',\n schema: S,\n events: {\n [kind === 'log' ? 'append' : 'screen']: kind === 'log' ? RunnerAppendSchema : RunnerScreenSchema,\n ping: Type.Literal(''),\n },\n },\n '404': { description: 'Runner unavailable.', schema: Type.Object({ error: S }) },\n },\n })),\n {\n id: 'runner.input',\n scope: 'session',\n basePath: 'runner',\n path: '/runners/{runId}/screen/input',\n method: 'POST',\n authentication: 'owner',\n description: 'Send text to an interactive runner.',\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Object({ text: Type.String({ minLength: 1 }) }),\n },\n responses: jsonApiResponses(Type.Object({ delivered: Type.Literal(true) })),\n },\n ],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'runner.channel',\n scope,\n service: 'po.hub',\n member: 'runner_runs',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Runner channel payload in the hub frame payload property.',\n input: RunnerPayloadSchema,\n })),\n});\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAM,IAAI,KAAK,OAAO;AACtB,MAAM,IAAI,KAAK,OAAO;AACtB,MAAM,IAAI,KAAK,QAAQ;AACvB,MAAM,IAAI,KAAK;AACf,MAAM,YAA8B,WAAgB,KAAK,MAAM,OAAO,KAAK,UAAU,KAAK,QAAQ,KAAK,CAAC,CAAC;AACzG,MAAM,MAAM,KAAK,OAAO;CACtB,IAAI;CACJ,MAAM;CACN,KAAK;CACL,SAAS;CACT,KAAK;CACL,aAAa;CACb,SAAS,SAAS;EAAC;EAAQ;EAAQ;CAAQ,CAAC;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,GAAI,CAAC,OAAO,QAAQ,CAAC,CAAW,KAAK,UAAU;GAC7C,IAAI,UAAU,KAAK;GACnB,OAAO;GACP,UAAU;GACV,MAAM,oBAAoB,KAAK;GAC/B,QAAQ;GACR,gBAAgB;GAChB,aAAa,iBAAiB,KAAK;GACnC,YAAY,CAAC;IAAE,MAAM;IAAQ,IAAI;IAAkB,UAAU;IAAO,QAAQ;GAAE,CAAC;GAC/E,WAAW;IACT,OAAO;KACL,aAAa;KACb,aAAa;KACb,QAAQ;KACR,QAAQ;OACL,SAAS,QAAQ,WAAW,WAAW,SAAS,QAAQ,qBAAqB;MAC9E,MAAM,KAAK,QAAQ,EAAE;KACvB;IACF;IACA,OAAO;KAAE,aAAa;KAAuB,QAAQ,KAAK,OAAO,EAAE,OAAO,EAAE,CAAC;IAAE;GACjF;EACF,EAAE;EACF;GACE,IAAI;GACJ,OAAO;GACP,UAAU;GACV,MAAM;GACN,QAAQ;GACR,gBAAgB;GAChB,aAAa;GACb,MAAM;IACJ,UAAU;IACV,aAAa;IACb,QAAQ,KAAK,OAAO,EAAE,MAAM,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;GAC7D;GACA,WAAW,iBAAiB,KAAK,OAAO,EAAE,WAAW,KAAK,QAAQ,IAAI,EAAE,CAAC,CAAC;EAC5E;CACF;CACA,SAAU,CAAC,UAAU,WAAW,CAAC,CAAW,KAAK,WAAW;EAC1D,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO;CACT,EAAE;AACJ,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as stripAnsi } from "./ansiScrub-CsqTSaVT.mjs";
|
|
2
|
-
import { a as getErrorPatterns, d as getResultMaxLines, f as getResultMaxTokens, h as getSuccessResultMaxTokens, i as getErrorMaxVariantsJoined, m as getSuccessResultMaxBytes, n as getErrorBudgetRatio, o as getHeadRatio, r as getErrorMaxEntries, u as getResultMaxBytes } from "./runnerConfig-
|
|
2
|
+
import { a as getErrorPatterns, d as getResultMaxLines, f as getResultMaxTokens, h as getSuccessResultMaxTokens, i as getErrorMaxVariantsJoined, m as getSuccessResultMaxBytes, n as getErrorBudgetRatio, o as getHeadRatio, r as getErrorMaxEntries, u as getResultMaxBytes } from "./runnerConfig-XXMq4VQA.mjs";
|
|
3
3
|
//#region src/constants/bashResult.ts
|
|
4
4
|
const BYTES_PER_KB = 1024;
|
|
5
5
|
const BYTES_PER_MB = 1048576;
|
|
6
|
-
const PRAGMA_PATTERN = /^\s*(?:#|\/\/)\s*@
|
|
6
|
+
const PRAGMA_PATTERN = /^\s*(?:#|\/\/)\s*@po:\s*(\{.*\})\s*$/u;
|
|
7
7
|
const PRAGMA_BYTES_CEILING = 262144;
|
|
8
8
|
const PRAGMA_LINES_CEILING = 5e3;
|
|
9
9
|
const PRAGMA_TOKENS_CEILING = 1e5;
|
|
@@ -134,7 +134,7 @@ function positiveInteger(value) {
|
|
|
134
134
|
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
* Reads `# @
|
|
137
|
+
* Reads `# @po: {"maxResultBytes": 32768}` from the command's first line.
|
|
138
138
|
*
|
|
139
139
|
* The pragma is a shell comment, so it stays harmless if this parse is ever
|
|
140
140
|
* skipped, and it survives verbatim into the log where a wider result can be
|
|
@@ -405,7 +405,7 @@ function composeExcerpt(headSource, tailSource, totalLines, maxLines = getResult
|
|
|
405
405
|
const salvaged = errorBytes > 0 ? renderSalvaged(errors, errorBytes, settings) : [];
|
|
406
406
|
return assembleSides(head, tail, Math.max(0, totalLines - head.count - tail.count), trailingNewline, limitBytes, salvaged);
|
|
407
407
|
}
|
|
408
|
-
/** Applies
|
|
408
|
+
/** Applies Po's line and byte ceilings to text already held in memory. */
|
|
409
409
|
function summarizeText(text, maxLines = getResultMaxLines(), maxBytes = getResultMaxBytes()) {
|
|
410
410
|
const excerpt = boundExcerpt(text, maxLines, maxBytes);
|
|
411
411
|
return {
|
|
@@ -446,7 +446,7 @@ function formatUptime(startedAt, now) {
|
|
|
446
446
|
}
|
|
447
447
|
const PROMOTION_REASONS = {
|
|
448
448
|
requested: "Started in the background",
|
|
449
|
-
threshold: "
|
|
449
|
+
threshold: "Over the background threshold",
|
|
450
450
|
interactive: "Started interactively"
|
|
451
451
|
};
|
|
452
452
|
function completionFailed(result) {
|
|
@@ -467,9 +467,10 @@ const emptyLogSummary = () => ({
|
|
|
467
467
|
function formatRunResult(result, budget = {}, summarizeLog = emptyLogSummary, settings, environment = process.env) {
|
|
468
468
|
if (result.kind === "failed") throw new Error([`Could not start runner "${result.name}": ${result.error}`, "Next: correct the reported launch or supervision problem. Retry only after changing the command or environment."].join("\n"));
|
|
469
469
|
if (result.kind === "promoted") return textResult([
|
|
470
|
-
`${PROMOTION_REASONS[result.reason]}: runner "${result.name}" (${result.id}).`,
|
|
470
|
+
`${PROMOTION_REASONS[result.reason]}: runner "${result.name}" (${result.id}) is running in the background.`,
|
|
471
|
+
"Its exit is reported here when it finishes; no need to poll.",
|
|
471
472
|
`Streaming log: ${result.logPath}`,
|
|
472
|
-
`
|
|
473
|
+
`Status: po-runner logs ${result.id}`
|
|
473
474
|
].join("\n"), {
|
|
474
475
|
id: result.id,
|
|
475
476
|
runner: result.name,
|
|
@@ -516,7 +517,7 @@ function formatRunResult(result, budget = {}, summarizeLog = emptyLogSummary, se
|
|
|
516
517
|
if (result.rtkWarning) textLines.push(result.rtkWarning);
|
|
517
518
|
if (truncated) {
|
|
518
519
|
const label = result.rtkOutput ? "Complete raw log" : "Full log";
|
|
519
|
-
textLines.push(`${label}: ${result.logPath} (${formatSize(log.bytes)}, ${log.lines.toLocaleString("en-US")} lines); inspect with
|
|
520
|
+
textLines.push(`${label}: ${result.logPath} (${formatSize(log.bytes)}, ${log.lines.toLocaleString("en-US")} lines); inspect with po-runner logs ${result.id}`);
|
|
520
521
|
} else if (failed && plainTail.length === 0) textLines.push(`Log: ${result.logPath}`, "Next: run one read-only diagnostic; retry only after correcting the cause.");
|
|
521
522
|
const text = boundResultText(textLines.join("\n"), maxBytes, settings, settings === void 0 ? void 0 : maxTokens);
|
|
522
523
|
const details = {
|
|
@@ -543,4 +544,4 @@ function formatRunResult(result, budget = {}, summarizeLog = emptyLogSummary, se
|
|
|
543
544
|
//#endregion
|
|
544
545
|
export { countLines as a, formatRunResult as c, formatUptime as d, parseResultPragma as f, composeExcerpt as i, formatRunnerLine as l, textResult as m, boundResultText as n, createErrorScanner as o, summarizeText as p, collectErrorLines as r, errorResult as s, boundExcerpt as t, formatSize as u };
|
|
545
546
|
|
|
546
|
-
//# sourceMappingURL=bashResult-
|
|
547
|
+
//# sourceMappingURL=bashResult-BqDa7sbC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bashResult-BqDa7sbC.mjs","names":[],"sources":["../src/constants/bashResult.ts","../src/constants/tokenEstimate.ts","../src/services/tokenEstimate/index.ts","../src/services/bashResult/index.ts"],"sourcesContent":["export const BYTES_PER_KB = 1024;\nexport const BYTES_PER_MB = 1_048_576;\nexport const MAX_VARIANTS_TRACKED = 12;\nexport const MIN_SHARED_AFFIX = 8;\nexport const ERROR_WINDOW_CHARS = 60;\nexport const PRAGMA_PATTERN = /^\\s*(?:#|\\/\\/)\\s*@po:\\s*(\\{.*\\})\\s*$/u;\nexport const PRAGMA_BYTES_CEILING = 262_144;\nexport const PRAGMA_LINES_CEILING = 5_000;\nexport const PRAGMA_TOKENS_CEILING = 100_000;\n","export const WORD_CHARS_PER_TOKEN = 5;\nexport const MIXED_CHARS_PER_TOKEN = 2.1;\nexport const PUNCTUATION_CHARS_PER_TOKEN = 2;\nexport const DENSE_SCRIPT_START = 0x2fff;\nexport const ASTRAL_TOKEN_COST = 2;\nexport const ALPHANUMERIC_RUN = /([^\\p{L}\\p{N}]+)/u;\nexport const HAS_ALPHANUMERIC = /[\\p{L}\\p{N}]/u;\nexport const HAS_DIGIT = /\\d/u;\nexport const HAS_LETTER = /[A-Za-z]/u;\n","import {\n ALPHANUMERIC_RUN,\n ASTRAL_TOKEN_COST,\n DENSE_SCRIPT_START,\n HAS_ALPHANUMERIC,\n HAS_DIGIT,\n HAS_LETTER,\n MIXED_CHARS_PER_TOKEN,\n PUNCTUATION_CHARS_PER_TOKEN,\n WORD_CHARS_PER_TOKEN,\n} from '../../constants/tokenEstimate';\n/**\n * Estimates BPE tokens without carrying a vocabulary.\n *\n * Bytes are a poor proxy for what a result costs: measured against\n * `gpt-tokenizer`, real text ranges from 1.4 characters per token for base64 to\n * 4.7 for English prose, a spread of more than three. Truncation runs on every\n * command and is synchronous, so loading a real tokenizer here would charge\n * every session for a table most of them never need.\n *\n * The shape below follows how BPE actually behaves: punctuation forces token\n * boundaries, natural words are cheap, and runs mixing letters with digits are\n * expensive. Calibrated against `gpt-tokenizer` over build logs, source, JSON,\n * stack traces, CJK, base64, hex, and UUIDs, the worst error is a factor of\n * 1.46 either way. It stays an estimate, so the byte ceiling remains the hard\n * bound behind it.\n */\n\n/** Characters per token for a natural word. */\n/** Characters per token for a run mixing letters and digits, which tokenizes poorly. */\n/** Characters per token for a run of punctuation or whitespace. */\n/** Dense scripts such as CJK cost about one token per character. */\n\nexport function estimateTokens(text: string): number {\n let tokens = 0;\n for (const run of text.split(ALPHANUMERIC_RUN)) {\n if (run.length === 0) continue;\n if (!HAS_ALPHANUMERIC.test(run)) {\n tokens += run.length / PUNCTUATION_CHARS_PER_TOKEN;\n continue;\n }\n\n let ascii = 0;\n let dense = 0;\n let astral = 0;\n for (const character of run) {\n const code = character.codePointAt(0) ?? 0;\n if (code > 0xffff) astral += 1;\n else if (code > DENSE_SCRIPT_START) dense += 1;\n else ascii += 1;\n }\n tokens += astral * ASTRAL_TOKEN_COST + dense;\n if (ascii > 0) {\n const mixed = HAS_DIGIT.test(run) && HAS_LETTER.test(run);\n tokens += Math.max(1, ascii / (mixed ? MIXED_CHARS_PER_TOKEN : WORD_CHARS_PER_TOKEN));\n }\n }\n return Math.ceil(tokens);\n}\n","import {\n BYTES_PER_KB,\n BYTES_PER_MB,\n ERROR_WINDOW_CHARS,\n MAX_VARIANTS_TRACKED,\n MIN_SHARED_AFFIX,\n PRAGMA_BYTES_CEILING,\n PRAGMA_LINES_CEILING,\n PRAGMA_PATTERN,\n PRAGMA_TOKENS_CEILING,\n} from '../../constants/bashResult';\nimport type {\n ErrorLineScanner,\n Excerpt,\n LogSummarizer,\n LogSummary,\n ResultBudget,\n SalvagedError,\n ToolResult,\n} from '../../types/bashResult';\nimport type { BashRunResult, CompletedRun } from '../../types/bashRunService';\nimport type { RunnerRecord } from '../../types/runnerRegistry';\nimport type { RunnerSettings } from '../../types/runnerSettings';\nimport { stripAnsi } from '../ansiScrub';\nimport {\n getErrorBudgetRatio,\n getErrorMaxEntries,\n getErrorMaxVariantsJoined,\n getErrorPatterns,\n getHeadRatio,\n getResultMaxBytes,\n getResultMaxLines,\n getResultMaxTokens,\n getSuccessResultMaxBytes,\n getSuccessResultMaxTokens,\n} from '../runnerConfig';\nimport { estimateTokens } from '../tokenEstimate';\n\n/** Variants retained per group while scanning; the rest only add to the count. */\n/** Below this much shared text, joining reads worse than separate lines. */\n/**\n * Severity anywhere in the opening of the line, not only at its start. Real\n * tooling buries it behind a tag or a timestamp: `[widget] build: error TS2322`.\n */\nconst SEVERITY_TOKEN =\n /(?<![\\w\\-/=.])(?:errors?|fatal|panic|exception|traceback|assertion|assert|fail(?:ed|ure|ures)?)\\b/iu;\n/** `0 errors` and `no failures` are the success case wearing the same words. */\nconst NEGATED_SEVERITY = /\\b(?:no|not|without|zero|0)\\s+$/iu;\n\nexport function textResult(text: string, details: Record<string, unknown> = {}): ToolResult {\n return { content: [{ type: 'text', text }], details };\n}\n\nexport function errorResult(message: string): ToolResult {\n return textResult(`Error: ${message}`, { error: message });\n}\n\n/** Human-readable byte count, matching how pi reports output sizes. */\nexport function formatSize(bytes: number): string {\n if (bytes < BYTES_PER_KB) return `${bytes} B`;\n if (bytes < BYTES_PER_MB) return `${(bytes / BYTES_PER_KB).toFixed(1)} KB`;\n return `${(bytes / BYTES_PER_MB).toFixed(1)} MB`;\n}\n\nfunction formatCount(value: number): string {\n return value.toLocaleString('en-US');\n}\n\nexport function countLines(text: string): number {\n if (text.length === 0) return 0;\n return text.endsWith('\\n') ? text.split('\\n').length - 1 : text.split('\\n').length;\n}\n\n/** Accumulates grouped error lines while a log streams past, without holding it. */\nclass ErrorScan {\n private readonly byKey = new Map<string, { variants: string[]; count: number }>();\n\n constructor(\n private readonly maxEntries = getErrorMaxEntries(),\n private readonly settings?: RunnerSettings,\n ) {}\n\n push(line: string): void {\n if (!isErrorLine(line, this.settings)) return;\n const trimmed = line.trim();\n const key = normalizeErrorLine(line);\n const existing = this.byKey.get(key);\n if (existing) {\n existing.count += 1;\n // Only a line we have not seen verbatim earns a slot; identical repeats\n // are carried by the count alone.\n if (!existing.variants.includes(trimmed) && existing.variants.length < MAX_VARIANTS_TRACKED) {\n existing.variants.push(trimmed);\n }\n return;\n }\n if (this.byKey.size >= this.maxEntries) return;\n this.byKey.set(key, { variants: [trimmed], count: 1 });\n }\n\n entries(): SalvagedError[] {\n return [...this.byKey.values()];\n }\n}\n\nexport function createErrorScanner(maxEntries = getErrorMaxEntries(), settings?: RunnerSettings): ErrorLineScanner {\n return new ErrorScan(maxEntries, settings);\n}\n\n/** Codex-style first-line pragma, for the one command that needs a wider result. */\n\nfunction positiveInteger(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : undefined;\n}\n\n/**\n * Reads `# @po: {\"maxResultBytes\": 32768}` from the command's first line.\n *\n * The pragma is a shell comment, so it stays harmless if this parse is ever\n * skipped, and it survives verbatim into the log where a wider result can be\n * explained after the fact.\n */\nexport function parseResultPragma(command: string): ResultBudget {\n const match = PRAGMA_PATTERN.exec(command.split('\\n', 1)[0] ?? '');\n if (!match?.[1]) return {};\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(match[1]);\n } catch {\n return {};\n }\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return {};\n\n const source = parsed as Record<string, unknown>;\n const maxBytes = positiveInteger(source.maxResultBytes);\n const maxLines = positiveInteger(source.maxResultLines);\n const maxTokens = positiveInteger(source.maxResultTokens);\n return {\n ...(maxBytes === undefined ? {} : { maxBytes: Math.min(maxBytes, PRAGMA_BYTES_CEILING) }),\n ...(maxLines === undefined ? {} : { maxLines: Math.min(maxLines, PRAGMA_LINES_CEILING) }),\n ...(maxTokens === undefined ? {} : { maxTokens: Math.min(maxTokens, PRAGMA_TOKENS_CEILING) }),\n };\n}\n\nfunction isErrorLine(line: string, settings?: RunnerSettings): boolean {\n const opening = line.slice(0, ERROR_WINDOW_CHARS);\n const match = SEVERITY_TOKEN.exec(opening);\n if (match && !NEGATED_SEVERITY.test(opening.slice(0, match.index))) return true;\n // Project patterns extend the built-in matcher; tooling this does not\n // recognise is exactly why they exist, so they are not negation-checked.\n return getErrorPatterns(settings).some((pattern) => matchesCustomPattern(pattern, line));\n}\n\nconst customPatterns = new Map<string, RegExp | undefined>();\n\nfunction matchesCustomPattern(pattern: string, line: string): boolean {\n if (!customPatterns.has(pattern)) {\n try {\n customPatterns.set(pattern, new RegExp(pattern, 'iu'));\n } catch {\n customPatterns.set(pattern, undefined);\n }\n }\n return customPatterns.get(pattern)?.test(line) ?? false;\n}\n\n/** Masks the parts that differ between repeats of the same underlying failure. */\nfunction normalizeErrorLine(line: string): string {\n return line\n .replace(/0x[0-9a-f]+/giu, '0x#')\n .replace(/\\/[^\\s:,)]+/gu, '/#')\n .replace(/\\d+/gu, '#')\n .trim()\n .toLowerCase();\n}\n\n/**\n * Collapses repeats so one failure repeated two hundred times costs one slot.\n * Counting continues past the entry cap so the tallies stay honest.\n */\nexport function collectErrorLines(\n lines: Iterable<string>,\n maxEntries = getErrorMaxEntries(),\n settings?: RunnerSettings,\n): SalvagedError[] {\n const scan = new ErrorScan(maxEntries, settings);\n for (const line of lines) scan.push(line);\n return scan.entries();\n}\n\nfunction commonAffixLengths(values: readonly string[]): { prefix: number; suffix: number } {\n const shortest = values.reduce((min, value) => Math.min(min, value.length), Infinity);\n let prefix = 0;\n while (prefix < shortest && values.every((value) => value[prefix] === values[0]![prefix])) prefix += 1;\n let suffix = 0;\n while (\n suffix < shortest - prefix &&\n values.every((value) => value[value.length - 1 - suffix] === values[0]![values[0]!.length - 1 - suffix])\n ) {\n suffix += 1;\n }\n return { prefix, suffix };\n}\n\n/** Back off to a whitespace boundary so the brackets hold whole tokens. */\nfunction retreatToBoundary(value: string, length: number): number {\n const boundary = value.lastIndexOf(' ', Math.max(0, length - 1));\n return boundary >= 0 ? boundary + 1 : 0;\n}\n\nfunction advanceToBoundary(value: string, length: number): number {\n const cut = value.length - length;\n const boundary = value.indexOf(' ', cut);\n return boundary >= 0 ? value.length - boundary : 0;\n}\n\n/**\n * One line per distinct failure would be ideal, but repeats of one failure\n * across many files are the common case. Sharing the fixed text and joining\n * only the parts that differ keeps every file name without paying for the\n * message N times.\n */\nfunction renderGroup(group: SalvagedError, settings?: RunnerSettings): string {\n const [first] = group.variants;\n if (first === undefined) return '';\n if (group.variants.length === 1) {\n return group.count > 1 ? `${first} (\\u00d7${formatCount(group.count)})` : first;\n }\n\n const shown = group.variants.slice(0, getErrorMaxVariantsJoined(settings));\n const { prefix, suffix } = commonAffixLengths(shown);\n const head = first.slice(0, retreatToBoundary(first, prefix));\n const tailLength = advanceToBoundary(first, suffix);\n const tail = tailLength > 0 ? first.slice(first.length - tailLength) : '';\n if (head.length + tail.length < MIN_SHARED_AFFIX) return shown.join('\\n');\n\n const middles = shown.map((value) => value.slice(head.length, value.length - tail.length));\n const overflow = group.variants.length - shown.length;\n const joined = overflow > 0 ? `${middles.join('|')}|+${formatCount(overflow)}` : middles.join('|');\n return `${head}[${joined}]${tail}`;\n}\n\nfunction renderSalvaged(errors: readonly SalvagedError[], maxBytes: number, settings?: RunnerSettings): string[] {\n const rendered: string[] = [];\n let used = 0;\n for (const group of errors) {\n const text = renderGroup(group, settings);\n if (text.length === 0) continue;\n const cost = Buffer.byteLength(text, 'utf8') + 1;\n if (used + cost > maxBytes) break;\n rendered.push(text);\n used += cost;\n }\n return rendered;\n}\n\ninterface Side {\n readonly text: string;\n readonly count: number;\n}\n\nfunction elisionMarker(elidedLines: number, salvagedCount = 0): string {\n const unit = elidedLines === 1 ? 'line' : 'lines';\n const errors = salvagedCount > 0 ? `, ${formatCount(salvagedCount)} shown below` : '';\n return `\\u2026 [${formatCount(elidedLines)} ${unit} elided${errors}] \\u2026`;\n}\n\nfunction splitTextLines(text: string): { lines: string[]; trailingNewline: boolean } {\n const trailingNewline = text.endsWith('\\n');\n const lines = text.split('\\n');\n if (trailingNewline) lines.pop();\n return { lines, trailingNewline };\n}\n\n/** Whole lines only: a fragment of a line reads as data that was never there. */\nfunction takeSide(\n lines: readonly string[],\n maxCount: number,\n maxBytes: number,\n fromEnd: boolean,\n maxTokens = Number.POSITIVE_INFINITY,\n): Side {\n if (maxBytes <= 0 || maxCount <= 0) return { text: '', count: 0 };\n const ordered = fromEnd ? [...lines].reverse() : [...lines];\n const taken: string[] = [];\n let used = 0;\n let tokens = 0;\n for (const line of ordered) {\n if (taken.length >= maxCount) break;\n const cost = Buffer.byteLength(line, 'utf8') + (taken.length > 0 ? 1 : 0);\n // Dense output costs far more context than its byte count implies, so the\n // token ceiling stops the side even while bytes remain. The separator is\n // charged too: summing per-line estimates otherwise drifts past the ceiling\n // once the newlines between them are counted.\n const lineTokens = estimateTokens(line) + (taken.length > 0 ? 1 : 0);\n if (used + cost > maxBytes || tokens + lineTokens > maxTokens) break;\n taken.push(line);\n used += cost;\n tokens += lineTokens;\n }\n if (taken.length === 0) return { text: '', count: 0 };\n const restored = fromEnd ? taken.reverse() : taken;\n return { text: restored.join('\\n'), count: restored.length };\n}\n\n/**\n * Used only when no whole line fits either side, which means the source has no\n * usable line boundary. A clamped fragment beats returning nothing at all.\n */\nfunction clampedFragment(text: string, limitBytes: number): Side {\n const clamped = utf8Tail(Buffer.from(text, 'utf8'), limitBytes);\n const newline = clamped.indexOf('\\n');\n const whole = newline >= 0 ? clamped.slice(newline + 1) : clamped;\n return { text: whole, count: whole.length > 0 ? 1 : 0 };\n}\n\n/** Charged against the budget so the composed excerpt still honours the ceiling. */\nfunction markerReservation(totalLines: number): number {\n return Buffer.byteLength(elisionMarker(totalLines), 'utf8') + 2;\n}\n\nfunction assembleSides(\n head: Side,\n tail: Side,\n elidedLines: number,\n trailingNewline: boolean,\n limitBytes: number,\n salvaged: readonly string[] = [],\n): Excerpt {\n const opening = elidedLines > 0 ? [elisionMarker(elidedLines, salvaged.length)] : [];\n const closing = elidedLines > 0 && salvaged.length > 0 ? ['\\u2026'] : [];\n const parts = [head.text, ...opening, ...salvaged, ...closing, tail.text].filter((part) => part.length > 0);\n const body = parts.join('\\n');\n const withNewline = trailingNewline && body.length > 0 ? `${body}\\n` : body;\n const encoded = Buffer.from(withNewline, 'utf8');\n // Last resort: the ceiling is a hard promise to the caller.\n const text = encoded.byteLength > limitBytes ? utf8Tail(encoded, limitBytes) : withNewline;\n return { text, lines: head.count + tail.count, truncated: true, elidedLines: Math.max(0, elidedLines) };\n}\n\nfunction budgetFor(\n maxLines: number,\n maxBytes: number,\n totalLines: number,\n maxTokens: number,\n settings?: RunnerSettings,\n) {\n const limitLines = Math.max(1, Math.floor(maxLines));\n const usable = Math.max(0, maxBytes - markerReservation(totalLines));\n // The marker is charged against both ceilings; counting it in bytes alone let\n // the composed excerpt drift past the token ceiling.\n const tokens = Math.max(1, Math.floor(maxTokens) - estimateTokens(elisionMarker(totalLines)));\n return {\n limitLines,\n headLines: Math.max(1, Math.floor(limitLines * getHeadRatio(settings))),\n headBytes: Math.max(0, Math.floor(usable * getHeadRatio(settings))),\n headTokens: Math.max(1, Math.floor(tokens * getHeadRatio(settings))),\n usable,\n tokens,\n };\n}\n\n/**\n * Bounds text to the budget, keeping a leading excerpt as well as the tail.\n *\n * Failures announce themselves at both ends: a command that could not start\n * says so on line one, and a command that died says so on the last. Keeping\n * only the tail loses the first kind entirely.\n */\nexport function boundExcerpt(\n text: string,\n maxLines = getResultMaxLines(),\n maxBytes = getResultMaxBytes(),\n maxTokens = getResultMaxTokens(),\n settings?: RunnerSettings,\n): Excerpt {\n if (text.length === 0) return { text: '', lines: 0, truncated: false, elidedLines: 0 };\n const { lines, trailingNewline } = splitTextLines(text);\n const totalBytes = Buffer.byteLength(text, 'utf8');\n const limitBytes = Number.isFinite(maxBytes) ? Math.max(0, Math.floor(maxBytes)) : totalBytes;\n const limitLines = Math.max(1, Math.floor(maxLines));\n if (lines.length <= limitLines && totalBytes <= limitBytes && estimateTokens(text) <= maxTokens) {\n return { text, lines: lines.length, truncated: false, elidedLines: 0 };\n }\n\n const budget = budgetFor(maxLines, limitBytes, lines.length, maxTokens, settings);\n const head = takeSide(lines, budget.headLines, budget.headBytes, false, budget.headTokens);\n const rest = lines.slice(head.count);\n // Reserved only when the region beyond the head actually holds errors, so a\n // clean run still spends the whole remaining budget on its tail.\n const errorBytes = rest.some((line) => isErrorLine(line, settings))\n ? Math.floor(budget.usable * getErrorBudgetRatio(settings))\n : 0;\n const tailBytes = budget.usable - Buffer.byteLength(head.text, 'utf8') - errorBytes;\n const tailTokens = budget.tokens - estimateTokens(head.text);\n const tail = takeSide(rest, Math.max(1, budget.limitLines - head.count), tailBytes, true, tailTokens);\n if (head.count === 0 && tail.count === 0) {\n const fragment = clampedFragment(text, limitBytes);\n return { text: fragment.text, lines: fragment.count, truncated: true, elidedLines: lines.length - fragment.count };\n }\n const middle = lines.slice(head.count, lines.length - tail.count);\n const salvaged =\n errorBytes > 0\n ? renderSalvaged(collectErrorLines(middle, getErrorMaxEntries(settings), settings), errorBytes, settings)\n : [];\n return assembleSides(head, tail, lines.length - head.count - tail.count, trailingNewline, limitBytes, salvaged);\n}\n\n/**\n * Same budget as `boundExcerpt`, for callers that streamed the two ends\n * separately and never held the middle. `totalLines` counts the whole source,\n * so the marker states what was dropped rather than what was captured.\n */\nexport function composeExcerpt(\n headSource: string,\n tailSource: string,\n totalLines: number,\n maxLines = getResultMaxLines(),\n maxBytes = getResultMaxBytes(),\n errors: readonly SalvagedError[] = [],\n maxTokens = getResultMaxTokens(),\n settings?: RunnerSettings,\n): Excerpt {\n const limitBytes = Number.isFinite(maxBytes) ? Math.max(0, Math.floor(maxBytes)) : Number.MAX_SAFE_INTEGER;\n const budget = budgetFor(maxLines, limitBytes, totalLines, maxTokens, settings);\n const headLines = splitTextLines(headSource).lines;\n const { lines: tailLines, trailingNewline } = splitTextLines(tailSource);\n // The line at each cut is a fragment of a line neither capture saw whole.\n const head = takeSide(\n headLines.slice(0, Math.max(0, headLines.length - 1)),\n budget.headLines,\n budget.headBytes,\n false,\n budget.headTokens,\n );\n const errorBytes = errors.length > 0 ? Math.floor(budget.usable * getErrorBudgetRatio(settings)) : 0;\n const tailBytes = budget.usable - Buffer.byteLength(head.text, 'utf8') - errorBytes;\n const tailTokens = budget.tokens - estimateTokens(head.text);\n const tail = takeSide(tailLines.slice(1), Math.max(1, budget.limitLines - head.count), tailBytes, true, tailTokens);\n if (head.count === 0 && tail.count === 0) {\n const fragment = clampedFragment(tailSource, limitBytes);\n return {\n text: fragment.text,\n lines: fragment.count,\n truncated: true,\n elidedLines: Math.max(0, totalLines - fragment.count),\n };\n }\n const salvaged = errorBytes > 0 ? renderSalvaged(errors, errorBytes, settings) : [];\n return assembleSides(\n head,\n tail,\n Math.max(0, totalLines - head.count - tail.count),\n trailingNewline,\n limitBytes,\n salvaged,\n );\n}\n\n/** Applies Po's line and byte ceilings to text already held in memory. */\nexport function summarizeText(\n text: string,\n maxLines = getResultMaxLines(),\n maxBytes = getResultMaxBytes(),\n): Pick<LogSummary, 'tail' | 'tailLines'> {\n const excerpt = boundExcerpt(text, maxLines, maxBytes);\n return { tail: excerpt.text, tailLines: excerpt.lines };\n}\n\n/** Bounds the complete model-facing result after status and recovery text are attached. */\nexport function boundResultText(\n text: string,\n maxBytes = getResultMaxBytes(),\n settings?: RunnerSettings,\n maxTokens = getResultMaxTokens(),\n): string {\n return boundExcerpt(text, getResultMaxLines(settings), maxBytes, maxTokens, settings).text;\n}\n\n/**\n * Keeps both ends of an oversized result and points at the file holding the rest.\n *\n * The notice states the file's real size and line count so the model does not\n * guess at offsets when it goes on to read the file, which is the failure this\n * whole policy exists to prevent.\n */\n\nfunction utf8Tail(encoded: Buffer<ArrayBufferLike>, maxBytes: number): string {\n let start = Math.max(0, encoded.byteLength - maxBytes);\n while (start < encoded.byteLength && (encoded[start]! & 0xc0) === 0x80) start += 1;\n return encoded.subarray(start).toString('utf8');\n}\n\n/** `name pid 1234 up 3m sleep 60` — one runner per line. */\nexport function formatRunnerLine(record: RunnerRecord, now = Date.now()): string {\n const mode = record.interactive ? ' interactive' : '';\n return `${record.name} pid ${record.pid} up ${formatUptime(record.startedAt, now)}${mode} ${record.command}`;\n}\n\nexport function formatUptime(startedAt: string, now: number): string {\n const started = Date.parse(startedAt);\n if (Number.isNaN(started)) return 'unknown';\n const seconds = Math.max(0, Math.floor((now - started) / 1000));\n if (seconds < 60) return `${seconds}s`;\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m`;\n const hours = Math.floor(minutes / 60);\n return hours < 24 ? `${hours}h` : `${Math.floor(hours / 24)}d`;\n}\n\nconst PROMOTION_REASONS: Record<'requested' | 'threshold' | 'interactive', string> = {\n requested: 'Started in the background',\n threshold: 'Over the background threshold',\n interactive: 'Started interactively',\n};\n\nfunction completionFailed(result: CompletedRun): boolean {\n return result.timedOut === true || result.signal !== null || (result.exitCode !== null && result.exitCode !== 0);\n}\n\nfunction completionStatus(result: CompletedRun): string | undefined {\n if (result.timedOut === true) return 'Timed out: exceeded the requested timeout.';\n if (result.signal !== null) return `Signal: ${result.signal}`;\n if (result.exitCode === null) return 'Exit status unavailable.';\n if (result.exitCode !== 0) return `Exit: ${result.exitCode}`;\n return undefined;\n}\n\nconst emptyLogSummary: LogSummarizer = () => ({ tail: '', bytes: 0, lines: 0, tailLines: 0 });\n\nexport function formatRunResult(\n result: BashRunResult,\n budget: ResultBudget = {},\n summarizeLog: LogSummarizer = emptyLogSummary,\n settings?: RunnerSettings,\n environment: NodeJS.ProcessEnv = process.env,\n): ToolResult {\n if (result.kind === 'failed') {\n throw new Error(\n [\n `Could not start runner \"${result.name}\": ${result.error}`,\n 'Next: correct the reported launch or supervision problem. Retry only after changing the command or environment.',\n ].join('\\n'),\n );\n }\n\n if (result.kind === 'promoted') {\n const reason = PROMOTION_REASONS[result.reason];\n const body = [\n `${reason}: runner \"${result.name}\" (${result.id}) is running in the background.`,\n 'Its exit is reported here when it finishes; no need to poll.',\n `Streaming log: ${result.logPath}`,\n `Status: po-runner logs ${result.id}`,\n ].join('\\n');\n return textResult(body, {\n id: result.id,\n runner: result.name,\n pid: result.pid,\n logPath: result.logPath,\n promoted: true,\n reason: result.reason,\n });\n }\n\n const succeeded = !completionFailed(result);\n const maxLines = budget.maxLines ?? getResultMaxLines(settings);\n const maxBytes =\n budget.maxBytes ??\n (succeeded ? getSuccessResultMaxBytes(environment, settings) : getResultMaxBytes(environment, settings));\n const maxTokens =\n budget.maxTokens ??\n (succeeded ? getSuccessResultMaxTokens(environment, settings) : getResultMaxTokens(environment, settings));\n const log = summarizeLog(result.logPath, maxLines, maxBytes, maxTokens);\n const useCapturedOutput = !result.rtkOutput && log.tail.length === 0 && result.output.length > 0;\n let tail: string;\n let tailLines: number;\n let outputLines: number;\n let outputBytes: number;\n let truncated: boolean;\n if (result.rtkOutput) {\n const clipped = Buffer.byteLength(result.rtkOutput.output, 'utf8') < result.rtkOutput.bytes;\n const bounded = clipped\n ? composeExcerpt(\n result.rtkOutput.head,\n result.rtkOutput.output,\n result.rtkOutput.lines,\n maxLines,\n maxBytes,\n [],\n maxTokens,\n settings,\n )\n : boundExcerpt(result.rtkOutput.output, maxLines, maxBytes, maxTokens, settings);\n tail = bounded.text;\n tailLines = bounded.lines;\n outputLines = result.rtkOutput.lines;\n outputBytes = result.rtkOutput.bytes;\n truncated = outputLines > tailLines || outputBytes > Buffer.byteLength(tail, 'utf8');\n } else {\n tail = useCapturedOutput ? result.output : log.tail;\n tailLines = useCapturedOutput ? countLines(tail) : log.tailLines;\n outputLines = Math.max(log.lines, tailLines);\n outputBytes = useCapturedOutput ? Buffer.byteLength(tail, 'utf8') : log.bytes;\n truncated = !useCapturedOutput && (outputLines > tailLines || outputBytes > Buffer.byteLength(tail, 'utf8'));\n }\n const plainTail = stripAnsi(tail).replace(/\\r?\\n$/u, '');\n const failed = completionFailed(result);\n const status = completionStatus(result);\n const textLines: string[] = [];\n if (plainTail.length === 0) {\n textLines.push(status === undefined ? 'Completed with no output.' : 'No output.');\n } else if (truncated) {\n const label = result.rtkOutput ? `RTK ${result.rtkOutput.filter} excerpt` : 'Log excerpt';\n textLines.push(\n `${label} (${tailLines.toLocaleString('en-US')} of ${outputLines.toLocaleString('en-US')} lines):\\n${plainTail}`,\n );\n } else {\n textLines.push(plainTail);\n }\n if (status !== undefined) textLines.push(status);\n if (result.rtkWarning) textLines.push(result.rtkWarning);\n if (truncated) {\n const label = result.rtkOutput ? 'Complete raw log' : 'Full log';\n textLines.push(\n `${label}: ${result.logPath} (${formatSize(log.bytes)}, ${log.lines.toLocaleString('en-US')} lines); inspect with po-runner logs ${result.id}`,\n );\n } else if (failed && plainTail.length === 0) {\n textLines.push(\n `Log: ${result.logPath}`,\n 'Next: run one read-only diagnostic; retry only after correcting the cause.',\n );\n }\n const text = boundResultText(\n textLines.join('\\n'),\n maxBytes,\n settings,\n settings === undefined ? undefined : maxTokens,\n );\n const details = {\n id: result.id,\n runner: result.name,\n exitCode: result.exitCode,\n logPath: result.logPath,\n backend: result.backend,\n fileSize: log.bytes,\n lines: useCapturedOutput ? tailLines : log.lines,\n tail,\n tailLines,\n ...(result.rtkOutput\n ? {\n rtkFilter: result.rtkOutput.filter,\n rtkOutputBytes: result.rtkOutput.bytes,\n rtkOutputLines: result.rtkOutput.lines,\n }\n : {}),\n ...(result.rtkWarning ? { rtkWarning: result.rtkWarning } : {}),\n ...(result.timedOut ? { timedOut: true } : {}),\n };\n if (failed) throw new Error(text);\n return textResult(text, details);\n}\n"],"mappings":";;;AAAA,MAAa,eAAe;AAC5B,MAAa,eAAe;AAI5B,MAAa,iBAAiB;AAC9B,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;AACpC,MAAa,wBAAwB;;;ACPrC,MAAa,wBAAwB;AAIrC,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,YAAY;AACzB,MAAa,aAAa;;;;;;;;;;;;;;;;;;;;;;;ACyB1B,SAAgB,eAAe,MAAsB;CACnD,IAAI,SAAS;CACb,KAAK,MAAM,OAAO,KAAK,MAAM,gBAAgB,GAAG;EAC9C,IAAI,IAAI,WAAW,GAAG;EACtB,IAAI,CAAC,iBAAiB,KAAK,GAAG,GAAG;GAC/B,UAAU,IAAI,SAAA;GACd;EACF;EAEA,IAAI,QAAQ;EACZ,IAAI,QAAQ;EACZ,IAAI,SAAS;EACb,KAAK,MAAM,aAAa,KAAK;GAC3B,MAAM,OAAO,UAAU,YAAY,CAAC,KAAK;GACzC,IAAI,OAAO,OAAQ,UAAU;QACxB,IAAI,OAAA,OAA2B,SAAS;QACxC,SAAS;EAChB;EACA,UAAU,SAAA,IAA6B;EACvC,IAAI,QAAQ,GAAG;GACb,MAAM,QAAQ,UAAU,KAAK,GAAG,KAAK,WAAW,KAAK,GAAG;GACxD,UAAU,KAAK,IAAI,GAAG,SAAS,QAAQ,wBAAA,EAA6C;EACtF;CACF;CACA,OAAO,KAAK,KAAK,MAAM;AACzB;;;;;;;;;ACdA,MAAM,iBACJ;;AAEF,MAAM,mBAAmB;AAEzB,SAAgB,WAAW,MAAc,UAAmC,CAAC,GAAe;CAC1F,OAAO;EAAE,SAAS,CAAC;GAAE,MAAM;GAAQ;EAAK,CAAC;EAAG;CAAQ;AACtD;AAEA,SAAgB,Y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U;EACnC,IACA,CAAC;EACL,GAAI,OAAO,aAAa,EAAE,YAAY,OAAO,WAAW,IAAI,CAAC;EAC7D,GAAI,OAAO,WAAW,EAAE,UAAU,KAAK,IAAI,CAAC;CAC9C;CACA,IAAI,QAAQ,MAAM,IAAI,MAAM,IAAI;CAChC,OAAO,WAAW,MAAM,OAAO;AACjC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_ansiScrub = require("./ansiScrub-D5gpHDch.cjs");
|
|
2
|
-
const require_runnerConfig = require("./runnerConfig-
|
|
2
|
+
const require_runnerConfig = require("./runnerConfig-BoLMinlx.cjs");
|
|
3
3
|
//#region src/constants/bashResult.ts
|
|
4
4
|
const BYTES_PER_KB = 1024;
|
|
5
5
|
const BYTES_PER_MB = 1048576;
|
|
6
|
-
const PRAGMA_PATTERN = /^\s*(?:#|\/\/)\s*@
|
|
6
|
+
const PRAGMA_PATTERN = /^\s*(?:#|\/\/)\s*@po:\s*(\{.*\})\s*$/u;
|
|
7
7
|
const PRAGMA_BYTES_CEILING = 262144;
|
|
8
8
|
const PRAGMA_LINES_CEILING = 5e3;
|
|
9
9
|
const PRAGMA_TOKENS_CEILING = 1e5;
|
|
@@ -134,7 +134,7 @@ function positiveInteger(value) {
|
|
|
134
134
|
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
* Reads `# @
|
|
137
|
+
* Reads `# @po: {"maxResultBytes": 32768}` from the command's first line.
|
|
138
138
|
*
|
|
139
139
|
* The pragma is a shell comment, so it stays harmless if this parse is ever
|
|
140
140
|
* skipped, and it survives verbatim into the log where a wider result can be
|
|
@@ -405,7 +405,7 @@ function composeExcerpt(headSource, tailSource, totalLines, maxLines = require_r
|
|
|
405
405
|
const salvaged = errorBytes > 0 ? renderSalvaged(errors, errorBytes, settings) : [];
|
|
406
406
|
return assembleSides(head, tail, Math.max(0, totalLines - head.count - tail.count), trailingNewline, limitBytes, salvaged);
|
|
407
407
|
}
|
|
408
|
-
/** Applies
|
|
408
|
+
/** Applies Po's line and byte ceilings to text already held in memory. */
|
|
409
409
|
function summarizeText(text, maxLines = require_runnerConfig.getResultMaxLines(), maxBytes = require_runnerConfig.getResultMaxBytes()) {
|
|
410
410
|
const excerpt = boundExcerpt(text, maxLines, maxBytes);
|
|
411
411
|
return {
|
|
@@ -446,7 +446,7 @@ function formatUptime(startedAt, now) {
|
|
|
446
446
|
}
|
|
447
447
|
const PROMOTION_REASONS = {
|
|
448
448
|
requested: "Started in the background",
|
|
449
|
-
threshold: "
|
|
449
|
+
threshold: "Over the background threshold",
|
|
450
450
|
interactive: "Started interactively"
|
|
451
451
|
};
|
|
452
452
|
function completionFailed(result) {
|
|
@@ -467,9 +467,10 @@ const emptyLogSummary = () => ({
|
|
|
467
467
|
function formatRunResult(result, budget = {}, summarizeLog = emptyLogSummary, settings, environment = process.env) {
|
|
468
468
|
if (result.kind === "failed") throw new Error([`Could not start runner "${result.name}": ${result.error}`, "Next: correct the reported launch or supervision problem. Retry only after changing the command or environment."].join("\n"));
|
|
469
469
|
if (result.kind === "promoted") return textResult([
|
|
470
|
-
`${PROMOTION_REASONS[result.reason]}: runner "${result.name}" (${result.id}).`,
|
|
470
|
+
`${PROMOTION_REASONS[result.reason]}: runner "${result.name}" (${result.id}) is running in the background.`,
|
|
471
|
+
"Its exit is reported here when it finishes; no need to poll.",
|
|
471
472
|
`Streaming log: ${result.logPath}`,
|
|
472
|
-
`
|
|
473
|
+
`Status: po-runner logs ${result.id}`
|
|
473
474
|
].join("\n"), {
|
|
474
475
|
id: result.id,
|
|
475
476
|
runner: result.name,
|
|
@@ -516,7 +517,7 @@ function formatRunResult(result, budget = {}, summarizeLog = emptyLogSummary, se
|
|
|
516
517
|
if (result.rtkWarning) textLines.push(result.rtkWarning);
|
|
517
518
|
if (truncated) {
|
|
518
519
|
const label = result.rtkOutput ? "Complete raw log" : "Full log";
|
|
519
|
-
textLines.push(`${label}: ${result.logPath} (${formatSize(log.bytes)}, ${log.lines.toLocaleString("en-US")} lines); inspect with
|
|
520
|
+
textLines.push(`${label}: ${result.logPath} (${formatSize(log.bytes)}, ${log.lines.toLocaleString("en-US")} lines); inspect with po-runner logs ${result.id}`);
|
|
520
521
|
} else if (failed && plainTail.length === 0) textLines.push(`Log: ${result.logPath}`, "Next: run one read-only diagnostic; retry only after correcting the cause.");
|
|
521
522
|
const text = boundResultText(textLines.join("\n"), maxBytes, settings, settings === void 0 ? void 0 : maxTokens);
|
|
522
523
|
const details = {
|
|
@@ -626,4 +627,4 @@ Object.defineProperty(exports, "textResult", {
|
|
|
626
627
|
}
|
|
627
628
|
});
|
|
628
629
|
|
|
629
|
-
//# sourceMappingURL=bashResult-
|
|
630
|
+
//# sourceMappingURL=bashResult-C2iKhHpD.cjs.map
|