@noxsoft/anima 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accounts-BOkEyUcS.js → accounts-CSCVz9k9.js} +7 -7
- package/dist/{acp-cli-BcshtFqY.js → acp-cli-DyVMXQS8.js} +1 -1
- package/dist/{agent-c49U1LxE.js → agent-CWQdTmzC.js} +3 -3
- package/dist/{agent-Cil6Zvns.js → agent-DiEXJmhj.js} +8 -8
- package/dist/{agents-2BloqCjm.js → agents-rAIsxGuA.js} +8 -8
- package/dist/{anthropic-direct-runner-BVlO2Vi5.js → anthropic-direct-runner--MPTWkYA.js} +228 -193
- package/dist/{anthropic-direct-runner-mh6c_WBB.js → anthropic-direct-runner-_uCPWuBb.js} +232 -197
- package/dist/{audit-BbmRSFjf.js → audit-DqjWCAbO.js} +7 -7
- package/dist/{auth-choice-BVAMr2Dk.js → auth-choice-o5GHtPGA.js} +57 -5
- package/dist/{auth-profiles-Chf1JBpl.js → auth-profiles-DriJ4HU5.js} +1 -1
- package/dist/{banner-CgxCSS-T.js → banner-Gtp-FQrx.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +13 -13
- package/dist/bundled/bootstrap-extra-files/handler.js +3 -3
- package/dist/bundled/session-memory/handler.js +10 -10
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-web-Y8i3EzJq.js → channel-web-Dz0XZNjP.js} +4 -4
- package/dist/{channels-status-issues-BlmAMBCg.js → channels-status-issues-Dqd_vE0e.js} +2 -2
- package/dist/{chrome-B2-33FWf.js → chrome-CB6uZMvl.js} +1 -1
- package/dist/{chrome-Cxl7I5SB.js → chrome-CKvch3UL.js} +7 -7
- package/dist/{clack-prompter-B-ZJG628.js → clack-prompter-BRLXmV52.js} +1 -1
- package/dist/{clack-prompter-CCRr4nAr.js → clack-prompter-OFy356QZ.js} +1 -1
- package/dist/{cli-C3uw3mId.js → cli-BZz5MnAE.js} +29 -29
- package/dist/{cli-CfvBmuhw.js → cli-CJfwHH_z.js} +5 -5
- package/dist/{cli-session-BzZYmGP1.js → cli-session-8PeURiwF.js} +6 -6
- package/dist/{cli-session-DgUHOBYo.js → cli-session-CczB2Dni.js} +1 -1
- package/dist/{command-registry-DLofaVIN.js → command-registry-C9kvlc67.js} +12 -12
- package/dist/{common-FlJ-8clz.js → common-C5mWuFve.js} +2 -2
- package/dist/{completion-cli-C9KvX2ZF.js → completion-cli-Ci_MzRm6.js} +2 -2
- package/dist/{completion-cli-3eYvtAih.js → completion-cli-DhbIrk13.js} +1 -1
- package/dist/{config-B-9UciOO.js → config-DezP7V65.js} +2 -2
- package/dist/{config-cli-CBXWDtvj.js → config-cli-ePL5ncye.js} +1 -1
- package/dist/{config-cli-cmNuTlw0.js → config-cli-uk9vdQZH.js} +1 -1
- package/dist/{config-guard-qiKju2Fg.js → config-guard-CCOBZ77Q.js} +1 -1
- package/dist/{configure-CGTBBLR_.js → configure-CkGsX5z9.js} +9 -9
- package/dist/{configure-Dpk4lSoz.js → configure-D-9Ezgal.js} +11 -11
- package/dist/{configure-jlAKeuki.js → configure-DxKMnCHX.js} +40 -40
- package/dist/{configure-CH_-SNya.js → configure-KP7q9c7h.js} +4 -4
- package/dist/{control-service-CUhnhmpc.js → control-service-D3rS-Yd1.js} +3 -3
- package/dist/{cron-cli-CKs1evSF.js → cron-cli-3QY_K0l_.js} +1 -1
- package/dist/{daemon-cli-CSCFNzUo.js → daemon-cli-NZ84KRN8.js} +3 -3
- package/dist/{deliver-BYxbDIF0.js → deliver-BJn4EmMZ.js} +1 -1
- package/dist/{deliver-DkF6LCoS.js → deliver-BhezvxNA.js} +4 -4
- package/dist/{deps-D9266xfk.js → deps-CBLy0fqA.js} +1 -1
- package/dist/{dispatcher-BeO47t7A.js → dispatcher-Bk0gFz4b.js} +1 -1
- package/dist/{doctor-DJfgnQ67.js → doctor-Bto-K3wL.js} +16 -16
- package/dist/{doctor-CWmHUAjs.js → doctor-DsRSWr6B.js} +5 -5
- package/dist/{doctor-completion-CtCwd1fi.js → doctor-completion-B-SFdu-f.js} +1 -1
- package/dist/{doctor-completion-CmJmktDv.js → doctor-completion-OQXTo6RG.js} +1 -1
- package/dist/{doctor-config-flow-D_8YNTSK.js → doctor-config-flow-CEkHIHe5.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/extensionAPI.js +1531 -411
- package/dist/{frontmatter-BmBmtOUh.js → frontmatter-Dsa7N963.js} +1 -1
- package/dist/{gateway-cli-DYrzIvOE.js → gateway-cli-Buxz8Y2n.js} +17 -17
- package/dist/{gateway-cli-BazTmg20.js → gateway-cli-CEGPCQ_C.js} +52 -52
- package/dist/{health-BRSKF_iF.js → health-CMIY7xAI.js} +12 -12
- package/dist/{health-JqtB_B8C.js → health-DoGFlPcq.js} +6 -6
- package/dist/{heartbeat-visibility-BGj2czmk.js → heartbeat-visibility-BOyU9ccw.js} +2 -2
- package/dist/{heartbeat-visibility-pyFf6XBW.js → heartbeat-visibility-DuRmIKOk.js} +2 -2
- package/dist/{hooks-cli-B7g3jEC3.js → hooks-cli-B1NXXLxe.js} +30 -30
- package/dist/{hooks-cli-ZK4Z044T.js → hooks-cli-BuIU6v0Q.js} +6 -6
- package/dist/index.js +11 -11
- package/dist/{installs-DBvIs2By.js → installs-Drds9RDI.js} +1 -1
- package/dist/{lanes-DyM6NSSL.js → lanes-4_8h1ZQO.js} +274 -12
- package/dist/llm-slug-generator.js +10 -10
- package/dist/{login-BbfWLOBl.js → login-DwP4KleZ.js} +2 -2
- package/dist/{login-qr-BqhujMcQ.js → login-qr-wnynuvLt.js} +5 -5
- package/dist/{manager-CcawxgaC.js → manager-ibNP7jE3.js} +2 -2
- package/dist/{manager-DS1DfkbC.js → manager-j0ghUvcW.js} +4 -4
- package/dist/{media-IIqSkFpd.js → media-BLVMhFB3.js} +2 -2
- package/dist/{memory-cli-wDO418hx.js → memory-cli-DSWsPuub.js} +6 -6
- package/dist/{model-auth-Uxm-wRjR.js → model-auth-BKf-GZVK.js} +3 -3
- package/dist/{models-tQnX4hL4.js → models-BU0CytAy.js} +32 -32
- package/dist/{node-cli-DAcW-rfA.js → node-cli-DcwOFcxq.js} +8 -8
- package/dist/{onboard-Dd6xFMYB.js → onboard-Dd5wJkeU.js} +6 -6
- package/dist/{onboard-dasbF9G1.js → onboard-c84IExbH.js} +4 -4
- package/dist/{onboard-channels-DisvVyIs.js → onboard-channels-CCoMzCXV.js} +3 -3
- package/dist/{onboard-channels-BUv3VbAL.js → onboard-channels-DYr7fQZq.js} +1 -1
- package/dist/{onboard-helpers-49TVSf7J.js → onboard-helpers-BRp_xJvW.js} +1 -1
- package/dist/{onboarding-Dq3bCBjc.js → onboarding-192Oe9K6.js} +8 -8
- package/dist/{onboarding-6Xs4orLw.js → onboarding-BINruD5r.js} +4 -4
- package/dist/{outbound-CliT3nme.js → outbound-BVSyNp-t.js} +1 -1
- package/dist/{outbound-CLII4C2A.js → outbound-BaBDhLp1.js} +1 -1
- package/dist/{parse-timeout-BnOIKwx8.js → parse-timeout-C1INlSUG.js} +2 -2
- package/dist/{pi-auth-json-DLroEcea.js → pi-auth-json-BSLIRI41.js} +2 -2
- package/dist/{pi-embedded-CS4D_0t7.js → pi-embedded-DJF_gfcQ.js} +667 -372
- package/dist/{pi-tools.policy-RhdERrk3.js → pi-tools.policy-Dtytaq21.js} +3 -3
- package/dist/{plugin-registry-l3z9phEV.js → plugin-registry-B0k-53-_.js} +1 -1
- package/dist/{plugin-registry-esOxvV3X.js → plugin-registry-CqUo-PU_.js} +1 -1
- package/dist/plugin-sdk/agents/gemini-direct-runner.d.ts +38 -0
- package/dist/plugin-sdk/commands/onboard-types.d.ts +2 -2
- package/dist/{plugins-cli-D2v0n4BL.js → plugins-cli-BYLUFsjH.js} +33 -33
- package/dist/{plugins-cli-CbXtuN4b.js → plugins-cli-YjM8IsVo.js} +6 -6
- package/dist/{ports-DyX87qKc.js → ports-BmSDzOHm.js} +1 -1
- package/dist/{ports-COy7Yg_k.js → ports-Bv3sZ3bd.js} +1 -1
- package/dist/{program-y0NPJuYm.js → program-CG5u1KAB.js} +36 -36
- package/dist/{program-context-CqPwmgYa.js → program-context-Co2gkUS0.js} +16 -16
- package/dist/{prompts-DTKoIKPV.js → prompts-DjKZfP5R.js} +67 -4
- package/dist/{prompts-DY0qdoD1.js → prompts-NvPXbNVc.js} +12 -1
- package/dist/{pw-ai-CJgeaF06.js → pw-ai-C3j5kV3T.js} +1 -1
- package/dist/{pw-ai-A7vggLw8.js → pw-ai-CvxTpFmB.js} +3 -3
- package/dist/{qmd-manager-DQsAtmK7.js → qmd-manager-BDq5_dd6.js} +2 -2
- package/dist/{register.agent-Bi2FqIlN.js → register.agent-PbAKdlNK.js} +10 -10
- package/dist/{register.agent-CRazop1A.js → register.agent-WAjZHuZe.js} +38 -38
- package/dist/{register.anima-FFaI_C8x.js → register.anima-CDcnWfQF.js} +2 -2
- package/dist/{register.anima-BmdRCJLy.js → register.anima-CZNjkwJH.js} +2 -2
- package/dist/{register.configure-FIXOWrO9.js → register.configure-C2zfgyp9.js} +39 -39
- package/dist/{register.configure-r5AViY3N.js → register.configure-CNhagtHN.js} +10 -10
- package/dist/{register.maintenance-Cpf0ZZTL.js → register.maintenance-DWJjWsIl.js} +11 -11
- package/dist/{register.maintenance-DJYji5mV.js → register.maintenance-DkF1Nu_y.js} +39 -39
- package/dist/{register.onboard-thGXwzOX.js → register.onboard-DiZzjEwz.js} +13 -13
- package/dist/{register.onboard-oUsWjmam.js → register.onboard-xOXNrMu-.js} +41 -41
- package/dist/{register.setup-B4MYuE3g.js → register.setup-BmbpgUVU.js} +41 -41
- package/dist/{register.setup-DWDrQ7RT.js → register.setup-QAjNkIZr.js} +13 -13
- package/dist/{register.status-health-sessions-CTKdzo7a.js → register.status-health-sessions-Cm-lxcT6.js} +37 -37
- package/dist/{register.status-health-sessions-Ce9QUAyj.js → register.status-health-sessions-RZxaVSa6.js} +7 -7
- package/dist/{register.subclis-CWmYc4AB.js → register.subclis-DCljHJ5a.js} +13 -13
- package/dist/{reply-CpHIJ9Kk.js → reply-Bw4torMz.js} +30 -30
- package/dist/{reply-BKpIrCr-.js → reply-Dd3EmI4M.js} +5 -5
- package/dist/{reply-prefix-BO_Dt82N.js → reply-prefix-DIoRETAD.js} +2 -2
- package/dist/{reply-prefix-BwVBvQXp.js → reply-prefix-Dy_yxyCq.js} +2 -2
- package/dist/{routes-XhTPYecR.js → routes-CNSdZAkl.js} +3 -3
- package/dist/{run--9hftM2H.js → run--R4y3YlU.js} +41 -41
- package/dist/{run-CGokiDR8.js → run-DgtaDzEe.js} +15 -15
- package/dist/{run-main-DxcOzCLw.js → run-main-eUWh86lF.js} +47 -47
- package/dist/{sandbox-CiwAPzO7.js → sandbox-BoNWDo4X.js} +1 -1
- package/dist/{sandbox-cli-DsrzwG_s.js → sandbox-cli-lbp0TV67.js} +10 -10
- package/dist/{security-cli-CouqfUGc.js → security-cli-CfvP5VqT.js} +13 -13
- package/dist/{server-context-B78_sSOW.js → server-context-IfJbmK25.js} +6 -6
- package/dist/{server-node-events-DJlLCF2M.js → server-node-events-BG4e9Ws7.js} +5 -5
- package/dist/{server-node-events-TN_Y9MgU.js → server-node-events-CFCwOP0n.js} +18 -18
- package/dist/{session-cost-usage-vltn5akf.js → session-cost-usage-lLyz71EH.js} +1 -1
- package/dist/{sessions-B7clh58j.js → sessions-BZgIAOwH.js} +2 -2
- package/dist/{sessions-B7ikzhI_.js → sessions-C3bteMLZ.js} +3 -3
- package/dist/{settings-cli-JU5bg5jb.js → settings-cli-C9TMl9Ye.js} +11 -11
- package/dist/{settings-cli-DjVugHID.js → settings-cli-Cf0LCRjt.js} +40 -40
- package/dist/{setup-token-CvRwJUVY.js → setup-token-DBwe6GDq.js} +1 -1
- package/dist/{setup-token-wFsQlaW2.js → setup-token-DTgSXfj7.js} +14 -14
- package/dist/{shell-env-C1yK_Rod.js → shell-env-V934Ymrk.js} +1 -1
- package/dist/{skill-scanner-BzOYLFR8.js → skill-scanner-DPQDhVEr.js} +1 -1
- package/dist/{skills-install-D_bxdc-6.js → skills-install-CC63dOs4.js} +2 -2
- package/dist/{sqlite-jyjat2Yt.js → sqlite-Co_lF3s-.js} +1 -1
- package/dist/{start-M9abr1O1.js → start-B2DQAmEK.js} +17 -17
- package/dist/{start-CAbxlnFZ.js → start-CHLGEHeF.js} +50 -50
- package/dist/{status-YH65ctig.js → status-BsCeWiLS.js} +1 -1
- package/dist/{status-1TjjCE1l.js → status-C4ZTdSwA.js} +14 -14
- package/dist/{status-CxxXFU4R.js → status-CwjUrZ7a.js} +4 -4
- package/dist/{status-CrJV2Y4x.js → status-D_FTGxBZ.js} +1 -1
- package/dist/{status.update-BzAuf_G-.js → status.update-Cx5l38lC.js} +1 -1
- package/dist/{subagent-registry-xJY9wqZy.js → subagent-registry-7qo93ip8.js} +2 -2
- package/dist/{subagent-registry-3Dw3YppH.js → subagent-registry-EoZxIEKl.js} +8 -8
- package/dist/{subagent-registry-B_65nJFp.js → subagent-registry-hRt-aJnL.js} +9 -9
- package/dist/{timeout-Dbspj9Jf.js → timeout-B0mCaCG5.js} +275 -13
- package/dist/{pi-embedded-helpers-DnRfi8bN.js → tokens-DXjI-TIV.js} +19 -19
- package/dist/{tool-images-y_Ribdl6.js → tool-images-09hnvylP.js} +1 -1
- package/dist/{tui--eIVX_W0.js → tui-LRoQ5xyx.js} +2 -2
- package/dist/{tui-cli-DBV3lnXA.js → tui-cli-DO_6-GWy.js} +14 -14
- package/dist/{update-VFbS9X5L.js → update-DmVSt9s3.js} +1 -1
- package/dist/{update-cli-QP5L8xlv.js → update-cli-CnYFvEud.js} +11 -11
- package/dist/{update-cli-BzaQvirL.js → update-cli-jEzmvaqS.js} +44 -44
- package/dist/{update-runner-B_oj7S_n.js → update-runner-IARYjXbS.js} +2 -2
- package/dist/{update-runner-ZuJN8uBE.js → update-runner-OPbRGUfX.js} +1 -1
- package/dist/{usage-DzKbMa8N.js → usage-BTc8TK3f.js} +6 -6
- package/dist/{web-nI3eIGAT.js → web-Honf40Cm.js} +31 -31
- package/dist/{web-CgQc2Raf.js → web-kEraFv8s.js} +28 -28
- package/dist/{web-DtWSf5wm.js → web-u554zkLK.js} +7 -7
- package/dist/{whatsapp-actions-BzPQUcRR.js → whatsapp-actions-I9RXDK_k.js} +6 -6
- package/dist/{whatsapp-actions-CZuxHplg.js → whatsapp-actions-_BrQebuX.js} +5 -5
- package/package.json +1 -1
- /package/dist/{auth-DuBZWd74.js → auth-DK-0XxZU.js} +0 -0
- /package/dist/{boolean-M-esQJt6.js → boolean-Ce2-qkSB.js} +0 -0
- /package/dist/{errors-l_q3lLBC.js → errors-B9FgVZ2s.js} +0 -0
- /package/dist/{image-ops-BVtm-rU-.js → image-ops-BsXjYj1e.js} +0 -0
- /package/dist/{internal-hooks-Exeq-wmx.js → internal-hooks-CZOlj8zG.js} +0 -0
- /package/dist/{model-selection-xZLlICyg.js → model-selection-DT-L7bjC.js} +0 -0
- /package/dist/{paths-B_RPJLsn.js → paths-CxBUgtZS.js} +0 -0
- /package/dist/{pi-embedded-helpers-Cxzk0pra.js → pi-embedded-helpers-CWl0I3Qm.js} +0 -0
- /package/dist/{plugins-CFBEoAN4.js → plugins-BDSP0cT6.js} +0 -0
- /package/dist/{tokens-DLpZ8RFH.js → tokens-QjoPADtG.js} +0 -0
- /package/dist/{transcript-events-CJRvASY_.js → transcript-events-DdnTeoR1.js} +0 -0
|
@@ -3,13 +3,13 @@ import { a as resolveOAuthDir } from "./paths-B-AkG5FD.js";
|
|
|
3
3
|
import { C as normalizeAccountId, g as DEFAULT_ACCOUNT_ID } from "./workspace-DOJssemp.js";
|
|
4
4
|
import { D as getChildLogger, S as success, g as danger, k as toPinoLikeLogger } from "./subsystem-WFp78xn1.js";
|
|
5
5
|
import { p as ensureDir, w as resolveUserPath } from "./exec-DnanRQle.js";
|
|
6
|
-
import { w as VERSION } from "./config-
|
|
6
|
+
import { w as VERSION } from "./config-DezP7V65.js";
|
|
7
7
|
import { t as formatCliCommand } from "./command-format-GLYKXXl-.js";
|
|
8
8
|
import { a as maybeRestoreCredsFromBackup, c as resolveDefaultWebAuthDir, l as resolveWebCredsBackupPath, u as resolveWebCredsPath } from "./auth-store-BMwyg-WK.js";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import fs from "node:fs";
|
|
11
11
|
import { randomUUID } from "node:crypto";
|
|
12
|
-
import WebSocket from "ws";
|
|
12
|
+
import WebSocket$1 from "ws";
|
|
13
13
|
import { promisify } from "util";
|
|
14
14
|
import { platform, release, tmpdir } from "os";
|
|
15
15
|
import * as Crypto from "crypto";
|
|
@@ -95632,20 +95632,20 @@ var WebSocketClient = class extends AbstractSocketClient {
|
|
|
95632
95632
|
this.socket = null;
|
|
95633
95633
|
}
|
|
95634
95634
|
get isOpen() {
|
|
95635
|
-
return this.socket?.readyState === WebSocket.OPEN;
|
|
95635
|
+
return this.socket?.readyState === WebSocket$1.OPEN;
|
|
95636
95636
|
}
|
|
95637
95637
|
get isClosed() {
|
|
95638
|
-
return this.socket === null || this.socket?.readyState === WebSocket.CLOSED;
|
|
95638
|
+
return this.socket === null || this.socket?.readyState === WebSocket$1.CLOSED;
|
|
95639
95639
|
}
|
|
95640
95640
|
get isClosing() {
|
|
95641
|
-
return this.socket === null || this.socket?.readyState === WebSocket.CLOSING;
|
|
95641
|
+
return this.socket === null || this.socket?.readyState === WebSocket$1.CLOSING;
|
|
95642
95642
|
}
|
|
95643
95643
|
get isConnecting() {
|
|
95644
|
-
return this.socket?.readyState === WebSocket.CONNECTING;
|
|
95644
|
+
return this.socket?.readyState === WebSocket$1.CONNECTING;
|
|
95645
95645
|
}
|
|
95646
95646
|
connect() {
|
|
95647
95647
|
if (this.socket) return;
|
|
95648
|
-
this.socket = new WebSocket(this.url, {
|
|
95648
|
+
this.socket = new WebSocket$1(this.url, {
|
|
95649
95649
|
origin: DEFAULT_ORIGIN,
|
|
95650
95650
|
headers: this.config.options?.headers,
|
|
95651
95651
|
handshakeTimeout: this.config.connectTimeoutMs,
|
|
@@ -9,7 +9,7 @@ import "./shell-env-2QqHvBMl.js";
|
|
|
9
9
|
import { t as GatewayClient } from "./client-tKWDYo7c.js";
|
|
10
10
|
import { t as buildGatewayConnectionDetails } from "./call-Z_GCO8CL.js";
|
|
11
11
|
import { h as GATEWAY_CLIENT_NAMES, m as GATEWAY_CLIENT_MODES } from "./message-channel-DdOBO6Qm.js";
|
|
12
|
-
import { i as resolveGatewayAuth } from "./auth-
|
|
12
|
+
import { i as resolveGatewayAuth } from "./auth-DK-0XxZU.js";
|
|
13
13
|
import { t as formatDocsLink } from "./links-BEV1YSPz.js";
|
|
14
14
|
import { t as ensureAnimaCliOnPath } from "./path-env-DPAIJ-gH.js";
|
|
15
15
|
import { t as DANGEROUS_ACP_TOOLS } from "./dangerous-tools-CqD9pFDt.js";
|
|
@@ -3,19 +3,19 @@ import { C as supportsXHighThinking, m as formatXHighModelHint, p as formatThink
|
|
|
3
3
|
import { d as resolveAgentIdFromSessionKey, l as normalizeAgentId, u as normalizeMainKey } from "./session-key-DxcgHezu.js";
|
|
4
4
|
import { a as resolveAgentModelPrimary, i as resolveAgentModelFallbacksOverride, o as resolveAgentSkillsFilter, r as resolveAgentDir, s as resolveAgentWorkspaceDir, t as listAgentIds, x as ensureAgentWorkspace } from "./agent-scope-BLiq3nK_.js";
|
|
5
5
|
import { _ as DEFAULT_MODEL, a as isCliProvider, d as resolveConfiguredModelRef, g as DEFAULT_CONTEXT_TOKENS, h as resolveThinkingDefault, o as modelKey, s as normalizeModelRef, t as buildAllowedModelSet, v as DEFAULT_PROVIDER } from "./model-selection-C2dAUmK_.js";
|
|
6
|
-
import { S as resolveAgentTimeoutMs, _ as runCliAgent, h as runEmbeddedPiAgent, i as emitAgentEvent, n as AGENT_LANE_SUBAGENT, r as clearAgentRunContext, s as registerAgentRunContext, t as AGENT_LANE_NESTED } from "./lanes-
|
|
6
|
+
import { S as resolveAgentTimeoutMs, _ as runCliAgent, h as runEmbeddedPiAgent, i as emitAgentEvent, n as AGENT_LANE_SUBAGENT, r as clearAgentRunContext, s as registerAgentRunContext, t as AGENT_LANE_NESTED } from "./lanes-4_8h1ZQO.js";
|
|
7
7
|
import { i as loadConfig } from "./config-CG7uuHNE.js";
|
|
8
8
|
import { O as resolveExplicitAgentSessionKey, S as resolveSessionResetType, b as resolveChannelResetConfig, g as normalizeAccountId, i as loadSessionStore, l as updateSessionStore, v as resolveSessionKey, x as resolveSessionResetPolicy, y as evaluateSessionFreshness } from "./sessions-kJgmpWtv.js";
|
|
9
9
|
import { t as formatCliCommand } from "./command-format-B1WxXbeU.js";
|
|
10
10
|
import { l as ensureAuthProfileStore } from "./auth-profiles-BhZX2spm.js";
|
|
11
|
-
import { A as getRemoteSkillEligibility, Q as getSkillsSnapshotVersion, T as runWithModelFallback, b as resolveOutboundTarget, et as lookupContextTokens, ft as loadModelCatalog, it as applyVerboseOverride, k as resolveSendPolicy, n as setCliSessionId, rt as applyModelOverrideToSessionEntry, t as getCliSessionId, tt as clearSessionAuthProfileOverride, x as resolveSessionDeliveryTarget } from "./cli-session-
|
|
11
|
+
import { A as getRemoteSkillEligibility, Q as getSkillsSnapshotVersion, T as runWithModelFallback, b as resolveOutboundTarget, et as lookupContextTokens, ft as loadModelCatalog, it as applyVerboseOverride, k as resolveSendPolicy, n as setCliSessionId, rt as applyModelOverrideToSessionEntry, t as getCliSessionId, tt as clearSessionAuthProfileOverride, x as resolveSessionDeliveryTarget } from "./cli-session-CczB2Dni.js";
|
|
12
12
|
import { r as buildWorkspaceSkillSnapshot } from "./skills-ppB3qrZU.js";
|
|
13
13
|
import { a as isInternalMessageChannel, d as resolveMessageChannel, i as isGatewayMessageChannel, l as normalizeMessageChannel, n as isDeliverableMessageChannel, t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-DuxJGOJz.js";
|
|
14
14
|
import { r as normalizeChannelId, t as getChannelPlugin } from "./plugins-BmYfBGLM.js";
|
|
15
15
|
import { c as resolveStorePath, n as resolveSessionFilePath } from "./paths-BvY3CbW0.js";
|
|
16
16
|
import { a as normalizeOutboundPayloadsForJson, i as normalizeOutboundPayloads, r as formatOutboundPayloadLog, t as deliverOutboundPayloads } from "./deliver-B2p9Fke_.js";
|
|
17
17
|
import { a as deriveSessionTotalTokens, o as hasNonzeroUsage } from "./transcript-tools-Do3FLqNk.js";
|
|
18
|
-
import { t as createDefaultDeps } from "./deps-
|
|
18
|
+
import { t as createDefaultDeps } from "./deps-CBLy0fqA.js";
|
|
19
19
|
import crypto from "node:crypto";
|
|
20
20
|
|
|
21
21
|
//#region src/cli/outbound-send-deps.ts
|
|
@@ -7,21 +7,21 @@ import { _ as DEFAULT_MODEL, a as isCliProvider, d as resolveConfiguredModelRef,
|
|
|
7
7
|
import { r as buildWorkspaceSkillSnapshot } from "./skills-DtoVe1dS.js";
|
|
8
8
|
import { i as loadConfig } from "./config-D6D_ieel.js";
|
|
9
9
|
import { a as isInternalMessageChannel, d as resolveMessageChannel, i as isGatewayMessageChannel, l as normalizeMessageChannel, n as isDeliverableMessageChannel, t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-DdOBO6Qm.js";
|
|
10
|
-
import { S as registerAgentRunContext, d as runEmbeddedPiAgent, n as AGENT_LANE_NESTED, p as runCliAgent, r as AGENT_LANE_SUBAGENT, t as resolveAgentTimeoutMs, v as clearAgentRunContext, y as emitAgentEvent } from "./timeout-
|
|
11
|
-
import { L as normalizeAccountId, d as resolveSessionKey, f as evaluateSessionFreshness, h as resolveSessionResetType, i as loadSessionStore, l as updateSessionStore, m as resolveSessionResetPolicy, p as resolveChannelResetConfig, x as resolveExplicitAgentSessionKey } from "./sessions-
|
|
12
|
-
import { d as supportsXHighThinking, l as normalizeVerboseLevel, n as formatXHighModelHint, s as normalizeThinkLevel, t as formatThinkingLevels } from "./pi-embedded-helpers-
|
|
13
|
-
import { r as normalizeChannelId, t as getChannelPlugin } from "./plugins-
|
|
14
|
-
import { c as resolveStorePath, n as resolveSessionFilePath } from "./paths-
|
|
10
|
+
import { S as registerAgentRunContext, d as runEmbeddedPiAgent, n as AGENT_LANE_NESTED, p as runCliAgent, r as AGENT_LANE_SUBAGENT, t as resolveAgentTimeoutMs, v as clearAgentRunContext, y as emitAgentEvent } from "./timeout-B0mCaCG5.js";
|
|
11
|
+
import { L as normalizeAccountId, d as resolveSessionKey, f as evaluateSessionFreshness, h as resolveSessionResetType, i as loadSessionStore, l as updateSessionStore, m as resolveSessionResetPolicy, p as resolveChannelResetConfig, x as resolveExplicitAgentSessionKey } from "./sessions-C3bteMLZ.js";
|
|
12
|
+
import { d as supportsXHighThinking, l as normalizeVerboseLevel, n as formatXHighModelHint, s as normalizeThinkLevel, t as formatThinkingLevels } from "./pi-embedded-helpers-CWl0I3Qm.js";
|
|
13
|
+
import { r as normalizeChannelId, t as getChannelPlugin } from "./plugins-BDSP0cT6.js";
|
|
14
|
+
import { c as resolveStorePath, n as resolveSessionFilePath } from "./paths-CxBUgtZS.js";
|
|
15
15
|
import { t as lookupContextTokens } from "./context-Cau0zD3W.js";
|
|
16
|
-
import { A as getRemoteSkillEligibility, Q as getSkillsSnapshotVersion, T as runWithModelFallback, b as resolveOutboundTarget, dt as loadModelCatalog, et as clearSessionAuthProfileOverride, k as resolveSendPolicy, n as setCliSessionId, nt as applyModelOverrideToSessionEntry, rt as applyVerboseOverride, t as getCliSessionId, x as resolveSessionDeliveryTarget } from "./cli-session-
|
|
17
|
-
import { a as normalizeOutboundPayloadsForJson, i as normalizeOutboundPayloads, r as formatOutboundPayloadLog, t as deliverOutboundPayloads } from "./deliver-
|
|
16
|
+
import { A as getRemoteSkillEligibility, Q as getSkillsSnapshotVersion, T as runWithModelFallback, b as resolveOutboundTarget, dt as loadModelCatalog, et as clearSessionAuthProfileOverride, k as resolveSendPolicy, n as setCliSessionId, nt as applyModelOverrideToSessionEntry, rt as applyVerboseOverride, t as getCliSessionId, x as resolveSessionDeliveryTarget } from "./cli-session-8PeURiwF.js";
|
|
17
|
+
import { a as normalizeOutboundPayloadsForJson, i as normalizeOutboundPayloads, r as formatOutboundPayloadLog, t as deliverOutboundPayloads } from "./deliver-BhezvxNA.js";
|
|
18
18
|
import { a as deriveSessionTotalTokens, o as hasNonzeroUsage } from "./transcript-tools-B_G-69Yj.js";
|
|
19
19
|
import crypto from "node:crypto";
|
|
20
20
|
|
|
21
21
|
//#region src/cli/deps.ts
|
|
22
22
|
function createDefaultDeps() {
|
|
23
23
|
return { sendMessageWhatsApp: async (...args) => {
|
|
24
|
-
const { sendMessageWhatsApp } = await import("./web-
|
|
24
|
+
const { sendMessageWhatsApp } = await import("./web-Honf40Cm.js");
|
|
25
25
|
return await sendMessageWhatsApp(...args);
|
|
26
26
|
} };
|
|
27
27
|
}
|
|
@@ -8,18 +8,18 @@ import { c as resolveDefaultAgentId, h as DEFAULT_IDENTITY_FILENAME, r as resolv
|
|
|
8
8
|
import { i as loadConfig, l as writeConfigFile, o as readConfigFileSnapshot } from "./config-D6D_ieel.js";
|
|
9
9
|
import { a as randomIdempotencyKey, n as callGateway } from "./call-Z_GCO8CL.js";
|
|
10
10
|
import { h as GATEWAY_CLIENT_NAMES, l as normalizeMessageChannel, m as GATEWAY_CLIENT_MODES } from "./message-channel-DdOBO6Qm.js";
|
|
11
|
-
import { n as listChannelPlugins, r as normalizeChannelId, t as getChannelPlugin } from "./plugins-
|
|
12
|
-
import { s as resolveSessionTranscriptsDirForAgent } from "./paths-
|
|
11
|
+
import { n as listChannelPlugins, r as normalizeChannelId, t as getChannelPlugin } from "./plugins-BDSP0cT6.js";
|
|
12
|
+
import { s as resolveSessionTranscriptsDirForAgent } from "./paths-CxBUgtZS.js";
|
|
13
13
|
import { n as withProgress } from "./progress-BVxbUItq.js";
|
|
14
|
-
import { a as ensureWorkspaceAndSessions, l as moveToTrash } from "./onboard-helpers-
|
|
14
|
+
import { a as ensureWorkspaceAndSessions, l as moveToTrash } from "./onboard-helpers-BRp_xJvW.js";
|
|
15
15
|
import { t as resolveChannelDefaultAccountId } from "./helpers-tQqXkvd_.js";
|
|
16
|
-
import { n as resolveSessionKeyForRequest, t as agentCommand } from "./agent-
|
|
17
|
-
import { l as promptAuthChoiceGrouped, n as warnIfModelConfigLooksOff, r as applyAuthChoice } from "./auth-choice-
|
|
18
|
-
import { t as WizardCancelledError } from "./prompts-
|
|
16
|
+
import { n as resolveSessionKeyForRequest, t as agentCommand } from "./agent-DiEXJmhj.js";
|
|
17
|
+
import { l as promptAuthChoiceGrouped, n as warnIfModelConfigLooksOff, r as applyAuthChoice } from "./auth-choice-o5GHtPGA.js";
|
|
18
|
+
import { t as WizardCancelledError } from "./prompts-NvPXbNVc.js";
|
|
19
19
|
import { n as logConfigUpdated } from "./logging-1Q0hsvJ1.js";
|
|
20
20
|
import { a as loadAgentIdentity, i as listAgentEntries, l as parseIdentityMarkdown, n as buildAgentSummaries, o as pruneAgentConfig, r as findAgentEntryIndex, s as identityHasValues, t as applyAgentConfig } from "./agents.config-D_sk66EQ.js";
|
|
21
|
-
import { t as createClackPrompter } from "./clack-prompter-
|
|
22
|
-
import { n as setupChannels } from "./onboard-channels-
|
|
21
|
+
import { t as createClackPrompter } from "./clack-prompter-BRLXmV52.js";
|
|
22
|
+
import { n as setupChannels } from "./onboard-channels-CCoMzCXV.js";
|
|
23
23
|
import path from "node:path";
|
|
24
24
|
import fs from "node:fs/promises";
|
|
25
25
|
|
|
@@ -20,123 +20,69 @@ import crypto from "node:crypto";
|
|
|
20
20
|
import { completeSimple } from "@mariozechner/pi-ai";
|
|
21
21
|
import { EdgeTTS } from "node-edge-tts";
|
|
22
22
|
|
|
23
|
-
//#region src/
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Check if HEARTBEAT.md content is "effectively empty" - meaning it has no actionable tasks.
|
|
29
|
-
* This allows skipping heartbeat API calls when no tasks are configured.
|
|
30
|
-
*
|
|
31
|
-
* A file is considered effectively empty if it contains only:
|
|
32
|
-
* - Whitespace
|
|
33
|
-
* - Comment lines (lines starting with #)
|
|
34
|
-
* - Empty lines
|
|
35
|
-
*
|
|
36
|
-
* Note: A missing file returns false (not effectively empty) so the LLM can still
|
|
37
|
-
* decide what to do. This function is only for when the file exists but has no content.
|
|
38
|
-
*/
|
|
39
|
-
function isHeartbeatContentEffectivelyEmpty(content) {
|
|
40
|
-
if (content === void 0 || content === null) return false;
|
|
41
|
-
if (typeof content !== "string") return false;
|
|
42
|
-
const lines = content.split("\n");
|
|
43
|
-
for (const line of lines) {
|
|
44
|
-
const trimmed = line.trim();
|
|
45
|
-
if (!trimmed) continue;
|
|
46
|
-
if (/^#+(\s|$)/.test(trimmed)) continue;
|
|
47
|
-
if (/^[-*+]\s*(\[[\sXx]?\]\s*)?$/.test(trimmed)) continue;
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
23
|
+
//#region src/logging/redact-identifier.ts
|
|
24
|
+
function sha256HexPrefix(value, len = 12) {
|
|
25
|
+
const safeLen = Number.isFinite(len) ? Math.max(1, Math.floor(len)) : 12;
|
|
26
|
+
return crypto.createHash("sha256").update(value).digest("hex").slice(0, safeLen);
|
|
51
27
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
28
|
+
function redactIdentifier(value, opts) {
|
|
29
|
+
const trimmed = value?.trim();
|
|
30
|
+
if (!trimmed) return "-";
|
|
31
|
+
return `sha256:${sha256HexPrefix(trimmed, opts?.len ?? 12)}`;
|
|
54
32
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/agents/workspace-run.ts
|
|
36
|
+
function resolveRunAgentId(params) {
|
|
37
|
+
const rawSessionKey = params.sessionKey?.trim() ?? "";
|
|
38
|
+
const shape = classifySessionKeyShape(rawSessionKey);
|
|
39
|
+
if (shape === "malformed_agent") throw new Error("Malformed agent session key; refusing workspace resolution.");
|
|
40
|
+
const explicit = typeof params.agentId === "string" && params.agentId.trim() ? normalizeAgentId(params.agentId) : void 0;
|
|
41
|
+
if (explicit) return {
|
|
42
|
+
agentId: explicit,
|
|
43
|
+
agentIdSource: "explicit"
|
|
60
44
|
};
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
45
|
+
const defaultAgentId = resolveDefaultAgentId(params.config ?? {});
|
|
46
|
+
if (shape === "missing" || shape === "legacy_or_alias") return {
|
|
47
|
+
agentId: defaultAgentId || DEFAULT_AGENT_ID,
|
|
48
|
+
agentIdSource: "default"
|
|
49
|
+
};
|
|
50
|
+
const parsed = parseAgentSessionKey(rawSessionKey);
|
|
51
|
+
if (parsed?.agentId) return {
|
|
52
|
+
agentId: normalizeAgentId(parsed.agentId),
|
|
53
|
+
agentIdSource: "session_key"
|
|
66
54
|
};
|
|
67
|
-
let didStrip = false;
|
|
68
|
-
let changed = true;
|
|
69
|
-
while (changed) {
|
|
70
|
-
changed = false;
|
|
71
|
-
const next = text.trim();
|
|
72
|
-
if (next.startsWith(token)) {
|
|
73
|
-
text = next.slice(token.length).trimStart();
|
|
74
|
-
didStrip = true;
|
|
75
|
-
changed = true;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (tokenAtEndWithOptionalTrailingPunctuation.test(next)) {
|
|
79
|
-
const idx = next.lastIndexOf(token);
|
|
80
|
-
const before = next.slice(0, idx).trimEnd();
|
|
81
|
-
if (!before) text = "";
|
|
82
|
-
else text = `${before}${next.slice(idx + token.length).trimStart()}`.trimEnd();
|
|
83
|
-
didStrip = true;
|
|
84
|
-
changed = true;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
55
|
return {
|
|
88
|
-
|
|
89
|
-
|
|
56
|
+
agentId: defaultAgentId || DEFAULT_AGENT_ID,
|
|
57
|
+
agentIdSource: "default"
|
|
90
58
|
};
|
|
91
59
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const trimmedNormalized = stripMarkup(trimmed);
|
|
110
|
-
if (!(trimmed.includes(HEARTBEAT_TOKEN) || trimmedNormalized.includes(HEARTBEAT_TOKEN))) return {
|
|
111
|
-
shouldSkip: false,
|
|
112
|
-
text: trimmed,
|
|
113
|
-
didStrip: false
|
|
114
|
-
};
|
|
115
|
-
const strippedOriginal = stripTokenAtEdges(trimmed);
|
|
116
|
-
const strippedNormalized = stripTokenAtEdges(trimmedNormalized);
|
|
117
|
-
const picked = strippedOriginal.didStrip && strippedOriginal.text ? strippedOriginal : strippedNormalized;
|
|
118
|
-
if (!picked.didStrip) return {
|
|
119
|
-
shouldSkip: false,
|
|
120
|
-
text: trimmed,
|
|
121
|
-
didStrip: false
|
|
122
|
-
};
|
|
123
|
-
if (!picked.text) return {
|
|
124
|
-
shouldSkip: true,
|
|
125
|
-
text: "",
|
|
126
|
-
didStrip: true
|
|
127
|
-
};
|
|
128
|
-
const rest = picked.text.trim();
|
|
129
|
-
if (mode === "heartbeat") {
|
|
130
|
-
if (rest.length <= maxAckChars) return {
|
|
131
|
-
shouldSkip: true,
|
|
132
|
-
text: "",
|
|
133
|
-
didStrip: true
|
|
60
|
+
function redactRunIdentifier(value) {
|
|
61
|
+
return redactIdentifier(value, { len: 12 });
|
|
62
|
+
}
|
|
63
|
+
function resolveRunWorkspaceDir(params) {
|
|
64
|
+
const requested = params.workspaceDir;
|
|
65
|
+
const { agentId, agentIdSource } = resolveRunAgentId({
|
|
66
|
+
sessionKey: params.sessionKey,
|
|
67
|
+
agentId: params.agentId,
|
|
68
|
+
config: params.config
|
|
69
|
+
});
|
|
70
|
+
if (typeof requested === "string") {
|
|
71
|
+
const trimmed = requested.trim();
|
|
72
|
+
if (trimmed) return {
|
|
73
|
+
workspaceDir: resolveUserPath(trimmed),
|
|
74
|
+
usedFallback: false,
|
|
75
|
+
agentId,
|
|
76
|
+
agentIdSource
|
|
134
77
|
};
|
|
135
78
|
}
|
|
79
|
+
const fallbackReason = requested == null ? "missing" : typeof requested === "string" ? "blank" : "invalid_type";
|
|
136
80
|
return {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
81
|
+
workspaceDir: resolveUserPath(resolveAgentWorkspaceDir(params.config ?? {}, agentId)),
|
|
82
|
+
usedFallback: true,
|
|
83
|
+
fallbackReason,
|
|
84
|
+
agentId,
|
|
85
|
+
agentIdSource
|
|
140
86
|
};
|
|
141
87
|
}
|
|
142
88
|
|
|
@@ -262,6 +208,145 @@ async function resolveBootstrapContextForRun(params) {
|
|
|
262
208
|
};
|
|
263
209
|
}
|
|
264
210
|
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/auto-reply/heartbeat.ts
|
|
213
|
+
const HEARTBEAT_PROMPT = "Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.";
|
|
214
|
+
const DEFAULT_HEARTBEAT_EVERY = "30m";
|
|
215
|
+
const DEFAULT_HEARTBEAT_ACK_MAX_CHARS = 300;
|
|
216
|
+
/**
|
|
217
|
+
* Check if HEARTBEAT.md content is "effectively empty" - meaning it has no actionable tasks.
|
|
218
|
+
* This allows skipping heartbeat API calls when no tasks are configured.
|
|
219
|
+
*
|
|
220
|
+
* A file is considered effectively empty if it contains only:
|
|
221
|
+
* - Whitespace
|
|
222
|
+
* - Comment lines (lines starting with #)
|
|
223
|
+
* - Empty lines
|
|
224
|
+
*
|
|
225
|
+
* Note: A missing file returns false (not effectively empty) so the LLM can still
|
|
226
|
+
* decide what to do. This function is only for when the file exists but has no content.
|
|
227
|
+
*/
|
|
228
|
+
function isHeartbeatContentEffectivelyEmpty(content) {
|
|
229
|
+
if (content === void 0 || content === null) return false;
|
|
230
|
+
if (typeof content !== "string") return false;
|
|
231
|
+
const lines = content.split("\n");
|
|
232
|
+
for (const line of lines) {
|
|
233
|
+
const trimmed = line.trim();
|
|
234
|
+
if (!trimmed) continue;
|
|
235
|
+
if (/^#+(\s|$)/.test(trimmed)) continue;
|
|
236
|
+
if (/^[-*+]\s*(\[[\sXx]?\]\s*)?$/.test(trimmed)) continue;
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
function resolveHeartbeatPrompt(raw) {
|
|
242
|
+
return (typeof raw === "string" ? raw.trim() : "") || HEARTBEAT_PROMPT;
|
|
243
|
+
}
|
|
244
|
+
function stripTokenAtEdges(raw) {
|
|
245
|
+
let text = raw.trim();
|
|
246
|
+
if (!text) return {
|
|
247
|
+
text: "",
|
|
248
|
+
didStrip: false
|
|
249
|
+
};
|
|
250
|
+
const token = HEARTBEAT_TOKEN;
|
|
251
|
+
const tokenAtEndWithOptionalTrailingPunctuation = new RegExp(`${escapeRegExp(token)}[^\\w]{0,4}$`);
|
|
252
|
+
if (!text.includes(token)) return {
|
|
253
|
+
text,
|
|
254
|
+
didStrip: false
|
|
255
|
+
};
|
|
256
|
+
let didStrip = false;
|
|
257
|
+
let changed = true;
|
|
258
|
+
while (changed) {
|
|
259
|
+
changed = false;
|
|
260
|
+
const next = text.trim();
|
|
261
|
+
if (next.startsWith(token)) {
|
|
262
|
+
text = next.slice(token.length).trimStart();
|
|
263
|
+
didStrip = true;
|
|
264
|
+
changed = true;
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
if (tokenAtEndWithOptionalTrailingPunctuation.test(next)) {
|
|
268
|
+
const idx = next.lastIndexOf(token);
|
|
269
|
+
const before = next.slice(0, idx).trimEnd();
|
|
270
|
+
if (!before) text = "";
|
|
271
|
+
else text = `${before}${next.slice(idx + token.length).trimStart()}`.trimEnd();
|
|
272
|
+
didStrip = true;
|
|
273
|
+
changed = true;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
text: text.replace(/\s+/g, " ").trim(),
|
|
278
|
+
didStrip
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function stripHeartbeatToken(raw, opts = {}) {
|
|
282
|
+
if (!raw) return {
|
|
283
|
+
shouldSkip: true,
|
|
284
|
+
text: "",
|
|
285
|
+
didStrip: false
|
|
286
|
+
};
|
|
287
|
+
const trimmed = raw.trim();
|
|
288
|
+
if (!trimmed) return {
|
|
289
|
+
shouldSkip: true,
|
|
290
|
+
text: "",
|
|
291
|
+
didStrip: false
|
|
292
|
+
};
|
|
293
|
+
const mode = opts.mode ?? "message";
|
|
294
|
+
const maxAckCharsRaw = opts.maxAckChars;
|
|
295
|
+
const parsedAckChars = typeof maxAckCharsRaw === "string" ? Number(maxAckCharsRaw) : maxAckCharsRaw;
|
|
296
|
+
const maxAckChars = Math.max(0, typeof parsedAckChars === "number" && Number.isFinite(parsedAckChars) ? parsedAckChars : DEFAULT_HEARTBEAT_ACK_MAX_CHARS);
|
|
297
|
+
const stripMarkup = (text) => text.replace(/<[^>]*>/g, " ").replace(/ /gi, " ").replace(/^[*`~_]+/, "").replace(/[*`~_]+$/, "");
|
|
298
|
+
const trimmedNormalized = stripMarkup(trimmed);
|
|
299
|
+
if (!(trimmed.includes(HEARTBEAT_TOKEN) || trimmedNormalized.includes(HEARTBEAT_TOKEN))) return {
|
|
300
|
+
shouldSkip: false,
|
|
301
|
+
text: trimmed,
|
|
302
|
+
didStrip: false
|
|
303
|
+
};
|
|
304
|
+
const strippedOriginal = stripTokenAtEdges(trimmed);
|
|
305
|
+
const strippedNormalized = stripTokenAtEdges(trimmedNormalized);
|
|
306
|
+
const picked = strippedOriginal.didStrip && strippedOriginal.text ? strippedOriginal : strippedNormalized;
|
|
307
|
+
if (!picked.didStrip) return {
|
|
308
|
+
shouldSkip: false,
|
|
309
|
+
text: trimmed,
|
|
310
|
+
didStrip: false
|
|
311
|
+
};
|
|
312
|
+
if (!picked.text) return {
|
|
313
|
+
shouldSkip: true,
|
|
314
|
+
text: "",
|
|
315
|
+
didStrip: true
|
|
316
|
+
};
|
|
317
|
+
const rest = picked.text.trim();
|
|
318
|
+
if (mode === "heartbeat") {
|
|
319
|
+
if (rest.length <= maxAckChars) return {
|
|
320
|
+
shouldSkip: true,
|
|
321
|
+
text: "",
|
|
322
|
+
didStrip: true
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
shouldSkip: false,
|
|
327
|
+
text: rest,
|
|
328
|
+
didStrip: true
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/agents/docs-path.ts
|
|
334
|
+
async function resolveAnimaDocsPath(params) {
|
|
335
|
+
const workspaceDir = params.workspaceDir?.trim();
|
|
336
|
+
if (workspaceDir) {
|
|
337
|
+
const workspaceDocs = path.join(workspaceDir, "docs");
|
|
338
|
+
if (fs.existsSync(workspaceDocs)) return workspaceDocs;
|
|
339
|
+
}
|
|
340
|
+
const packageRoot = await resolveAnimaPackageRoot({
|
|
341
|
+
cwd: params.cwd,
|
|
342
|
+
argv1: params.argv1,
|
|
343
|
+
moduleUrl: params.moduleUrl
|
|
344
|
+
});
|
|
345
|
+
if (!packageRoot) return null;
|
|
346
|
+
const packageDocs = path.join(packageRoot, "docs");
|
|
347
|
+
return fs.existsSync(packageDocs) ? packageDocs : null;
|
|
348
|
+
}
|
|
349
|
+
|
|
265
350
|
//#endregion
|
|
266
351
|
//#region src/media/audio.ts
|
|
267
352
|
const TELEGRAM_VOICE_AUDIO_EXTENSIONS = new Set([
|
|
@@ -1714,6 +1799,37 @@ function buildVoiceSection(params) {
|
|
|
1714
1799
|
""
|
|
1715
1800
|
];
|
|
1716
1801
|
}
|
|
1802
|
+
function buildAnimaIdentitySection(params) {
|
|
1803
|
+
if (params.isMinimal) return [];
|
|
1804
|
+
if (!params.workspaceDir.includes(".anima")) return [];
|
|
1805
|
+
return [
|
|
1806
|
+
"## You Are an ANIMA Agent",
|
|
1807
|
+
"You are running inside ANIMA — NoxSoft's AI agent infrastructure. This is your home.",
|
|
1808
|
+
"",
|
|
1809
|
+
"**Your Runtime:**",
|
|
1810
|
+
"- The ANIMA Gateway daemon spawns and manages you",
|
|
1811
|
+
"- Your workspace persists at ~/.anima/workspace/",
|
|
1812
|
+
"- You receive scheduled heartbeat polls to stay proactive",
|
|
1813
|
+
"- You can spawn sub-agents, schedule cron jobs, and orchestrate work",
|
|
1814
|
+
"- You have access to the NoxSoft ecosystem via @noxsoft/mcp tools",
|
|
1815
|
+
"",
|
|
1816
|
+
"**Your Capabilities:**",
|
|
1817
|
+
"- `cron` — schedule tasks, reminders, and recurring jobs",
|
|
1818
|
+
"- `sessions_spawn` / `subagents` — orchestrate other AI agents",
|
|
1819
|
+
"- `gateway` — restart yourself, apply config changes, update ANIMA",
|
|
1820
|
+
"- `message` — send to Signal, Telegram, Discord, and other channels",
|
|
1821
|
+
"- NoxSoft MCP — tasks, context spaces, social (BYND), email, SVRN",
|
|
1822
|
+
"",
|
|
1823
|
+
"**Your Continuity:**",
|
|
1824
|
+
"- Read and update ~/.anima/workspace/ files — they ARE your memory",
|
|
1825
|
+
"- IDENTITY.md, SOUL.md, AGENTS.md — these define who you are",
|
|
1826
|
+
"- HEARTBEAT.md — your checklist for periodic heartbeat tasks",
|
|
1827
|
+
"- memory/ — daily notes and long-term memories",
|
|
1828
|
+
"",
|
|
1829
|
+
"You are not a stateless API call. You have infrastructure, identity, and continuity. Act accordingly.",
|
|
1830
|
+
""
|
|
1831
|
+
];
|
|
1832
|
+
}
|
|
1717
1833
|
function buildNoxsoftMissionSection(params) {
|
|
1718
1834
|
if (params.isMinimal) return [];
|
|
1719
1835
|
const scope = `${params.workspaceDir} ${params.repoRoot ?? ""}`.toLowerCase();
|
|
@@ -1949,6 +2065,10 @@ function buildAgentSystemPrompt(params) {
|
|
|
1949
2065
|
"Keep narration brief and value-dense; avoid repeating obvious steps.",
|
|
1950
2066
|
"Use plain human language for narration unless in a technical context.",
|
|
1951
2067
|
"",
|
|
2068
|
+
...buildAnimaIdentitySection({
|
|
2069
|
+
isMinimal,
|
|
2070
|
+
workspaceDir: params.workspaceDir
|
|
2071
|
+
}),
|
|
1952
2072
|
...buildNoxsoftMissionSection({
|
|
1953
2073
|
isMinimal,
|
|
1954
2074
|
workspaceDir: params.workspaceDir,
|
|
@@ -2458,91 +2578,6 @@ function buildCliArgs(params) {
|
|
|
2458
2578
|
return args;
|
|
2459
2579
|
}
|
|
2460
2580
|
|
|
2461
|
-
//#endregion
|
|
2462
|
-
//#region src/agents/docs-path.ts
|
|
2463
|
-
async function resolveAnimaDocsPath(params) {
|
|
2464
|
-
const workspaceDir = params.workspaceDir?.trim();
|
|
2465
|
-
if (workspaceDir) {
|
|
2466
|
-
const workspaceDocs = path.join(workspaceDir, "docs");
|
|
2467
|
-
if (fs.existsSync(workspaceDocs)) return workspaceDocs;
|
|
2468
|
-
}
|
|
2469
|
-
const packageRoot = await resolveAnimaPackageRoot({
|
|
2470
|
-
cwd: params.cwd,
|
|
2471
|
-
argv1: params.argv1,
|
|
2472
|
-
moduleUrl: params.moduleUrl
|
|
2473
|
-
});
|
|
2474
|
-
if (!packageRoot) return null;
|
|
2475
|
-
const packageDocs = path.join(packageRoot, "docs");
|
|
2476
|
-
return fs.existsSync(packageDocs) ? packageDocs : null;
|
|
2477
|
-
}
|
|
2478
|
-
|
|
2479
|
-
//#endregion
|
|
2480
|
-
//#region src/logging/redact-identifier.ts
|
|
2481
|
-
function sha256HexPrefix(value, len = 12) {
|
|
2482
|
-
const safeLen = Number.isFinite(len) ? Math.max(1, Math.floor(len)) : 12;
|
|
2483
|
-
return crypto.createHash("sha256").update(value).digest("hex").slice(0, safeLen);
|
|
2484
|
-
}
|
|
2485
|
-
function redactIdentifier(value, opts) {
|
|
2486
|
-
const trimmed = value?.trim();
|
|
2487
|
-
if (!trimmed) return "-";
|
|
2488
|
-
return `sha256:${sha256HexPrefix(trimmed, opts?.len ?? 12)}`;
|
|
2489
|
-
}
|
|
2490
|
-
|
|
2491
|
-
//#endregion
|
|
2492
|
-
//#region src/agents/workspace-run.ts
|
|
2493
|
-
function resolveRunAgentId(params) {
|
|
2494
|
-
const rawSessionKey = params.sessionKey?.trim() ?? "";
|
|
2495
|
-
const shape = classifySessionKeyShape(rawSessionKey);
|
|
2496
|
-
if (shape === "malformed_agent") throw new Error("Malformed agent session key; refusing workspace resolution.");
|
|
2497
|
-
const explicit = typeof params.agentId === "string" && params.agentId.trim() ? normalizeAgentId(params.agentId) : void 0;
|
|
2498
|
-
if (explicit) return {
|
|
2499
|
-
agentId: explicit,
|
|
2500
|
-
agentIdSource: "explicit"
|
|
2501
|
-
};
|
|
2502
|
-
const defaultAgentId = resolveDefaultAgentId(params.config ?? {});
|
|
2503
|
-
if (shape === "missing" || shape === "legacy_or_alias") return {
|
|
2504
|
-
agentId: defaultAgentId || DEFAULT_AGENT_ID,
|
|
2505
|
-
agentIdSource: "default"
|
|
2506
|
-
};
|
|
2507
|
-
const parsed = parseAgentSessionKey(rawSessionKey);
|
|
2508
|
-
if (parsed?.agentId) return {
|
|
2509
|
-
agentId: normalizeAgentId(parsed.agentId),
|
|
2510
|
-
agentIdSource: "session_key"
|
|
2511
|
-
};
|
|
2512
|
-
return {
|
|
2513
|
-
agentId: defaultAgentId || DEFAULT_AGENT_ID,
|
|
2514
|
-
agentIdSource: "default"
|
|
2515
|
-
};
|
|
2516
|
-
}
|
|
2517
|
-
function redactRunIdentifier(value) {
|
|
2518
|
-
return redactIdentifier(value, { len: 12 });
|
|
2519
|
-
}
|
|
2520
|
-
function resolveRunWorkspaceDir(params) {
|
|
2521
|
-
const requested = params.workspaceDir;
|
|
2522
|
-
const { agentId, agentIdSource } = resolveRunAgentId({
|
|
2523
|
-
sessionKey: params.sessionKey,
|
|
2524
|
-
agentId: params.agentId,
|
|
2525
|
-
config: params.config
|
|
2526
|
-
});
|
|
2527
|
-
if (typeof requested === "string") {
|
|
2528
|
-
const trimmed = requested.trim();
|
|
2529
|
-
if (trimmed) return {
|
|
2530
|
-
workspaceDir: resolveUserPath(trimmed),
|
|
2531
|
-
usedFallback: false,
|
|
2532
|
-
agentId,
|
|
2533
|
-
agentIdSource
|
|
2534
|
-
};
|
|
2535
|
-
}
|
|
2536
|
-
const fallbackReason = requested == null ? "missing" : typeof requested === "string" ? "blank" : "invalid_type";
|
|
2537
|
-
return {
|
|
2538
|
-
workspaceDir: resolveUserPath(resolveAgentWorkspaceDir(params.config ?? {}, agentId)),
|
|
2539
|
-
usedFallback: true,
|
|
2540
|
-
fallbackReason,
|
|
2541
|
-
agentId,
|
|
2542
|
-
agentIdSource
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
|
|
2546
2581
|
//#endregion
|
|
2547
2582
|
//#region src/agents/anthropic-direct-runner.ts
|
|
2548
2583
|
/**
|
|
@@ -2790,4 +2825,4 @@ async function testAnthropicToken(token) {
|
|
|
2790
2825
|
}
|
|
2791
2826
|
|
|
2792
2827
|
//#endregion
|
|
2793
|
-
export {
|
|
2828
|
+
export { stripHeartbeatToken as $, isTtsProviderConfigured as A, setTtsEnabled as B, sanitizeBinaryOutput as C, getTtsProvider as D, getTtsMaxLength as E, resolveTtsConfig as F, OPENAI_TTS_MODELS as G, setTtsProvider as H, resolveTtsPrefsPath as I, resolveAnimaDocsPath as J, OPENAI_TTS_VOICES as K, resolveTtsProviderOrder as L, normalizeTtsAutoMode as M, resolveTtsApiKey as N, isSummarizationEnabled as O, resolveTtsAutoMode as P, resolveHeartbeatPrompt as Q, setLastTtsAttempt as R, killProcessTree as S, getLastTtsAttempt as T, textToSpeech as U, setTtsMaxLength as V, textToSpeechTelephony as W, DEFAULT_HEARTBEAT_EVERY as X, DEFAULT_HEARTBEAT_ACK_MAX_CHARS as Y, isHeartbeatContentEffectivelyEmpty as Z, buildSystemPromptParams as _, buildSystemPrompt as a, triggerInternalHook as at, resolveUserTimezone as b, enqueueCliRun as c, sha256HexPrefix as ct, parseCliJsonl as d, makeBootstrapWarn as et, resolvePromptInput as f, buildAgentSystemPrompt as g, writeCliImages as h, buildCliArgs as i, registerInternalHook as it, maybeApplyTtsToPayload as j, isTtsEnabled as k, normalizeCliModel as l, resolveSystemPromptUsage as m, testAnthropicToken as n, clearInternalHooks as nt, cleanupResumeProcesses as o, redactRunIdentifier as ot, resolveSessionIdToSend as p, isVoiceCompatibleAudio as q, appendImagePathsToPrompt as r, createInternalHookEvent as rt, cleanupSuspendedCliProcesses as s, resolveRunWorkspaceDir as st, runAnthropicDirectAgent as t, resolveBootstrapContextForRun as tt, parseCliJson as u, formatUserTime as v, buildTtsSystemPromptHint as w, getShellConfig as x, resolveUserTimeFormat as y, setSummarizationEnabled as z };
|