@symerian/symi 2.8.12 → 2.8.14
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-BuZxOb3B.js → accounts-Bsg6r6H7.js} +1 -1
- package/dist/{accounts-BRw8yhIW.js → accounts-BsgY6sda.js} +21 -21
- package/dist/{accounts-3dCrO3oZ.js → accounts-wWWkC0JH.js} +1 -1
- package/dist/{active-listener-BVZOh2T1.js → active-listener-AVNn5_U9.js} +1 -1
- package/dist/{agent-scope-CpEJ0B88.js → agent-scope-Cpm7a9ss.js} +3 -3
- package/dist/{agents-OAonMxYV.js → agents-DlAvDWxz.js} +4 -4
- package/dist/{agents.config-BIhaDwT2.js → agents.config-BKKMbeeE.js} +1 -1
- package/dist/{agents.config-DGu_K5xz.js → agents.config-Dd-11klq.js} +1 -1
- package/dist/{audio-preflight-Cb-T0r6e.js → audio-preflight-rrz8KyHd.js} +29 -29
- package/dist/{audit-Bi9Je9FZ.js → audit-BhCJV2l6.js} +1 -1
- package/dist/{audit-Oa5dsn5p.js → audit-CB97BqHJ.js} +1 -1
- package/dist/{auth-choice-BvPX7B4c.js → auth-choice-C6woT6k2.js} +1 -1
- package/dist/{auth-choice-DDzWns1k.js → auth-choice-CRQRPwQt.js} +1 -1
- package/dist/{auth-profiles-C2vj6htZ.js → auth-profiles-BzB_Exeq.js} +17 -17
- package/dist/{banner-BFdiq-O5.js → banner-DrNha2_N.js} +1 -1
- package/dist/{bindings-BsHoBLIE.js → bindings-xcRox9xM.js} +2 -2
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +54 -54
- package/dist/bundled/bootstrap-extra-files/handler.js +5 -5
- package/dist/bundled/command-logger/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +54 -54
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-activity-D8QD7GoV.js → channel-activity-CzHaIUAp.js} +1 -1
- package/dist/{channel-options-DTqUB0OP.js → channel-options-D8q9En4T.js} +1 -1
- package/dist/{channel-options-tfnOGSNF.js → channel-options-DYy2sCfN.js} +1 -1
- package/dist/{channel-web-CcUXobcu.js → channel-web-CRBU4eZk.js} +1 -1
- package/dist/{channels-cli-CmShA-wJ.js → channels-cli-BUk43hHR.js} +7 -7
- package/dist/{channels-cli-BcE5tHIr.js → channels-cli-Dk3kUw9A.js} +7 -7
- package/dist/{chrome-ROtrXlNs.js → chrome-DwXnykXR.js} +14 -14
- package/dist/{chunk-BRe1o4Af.js → chunk-BcxcL1U3.js} +1 -1
- package/dist/{cli-BxoD2wzk.js → cli-5gWsnsB7.js} +4 -4
- package/dist/{cli-CKG2iAr3.js → cli-DjZzJy3t.js} +4 -4
- package/dist/{command-registry-D1Le-Fmh.js → command-registry-LjFltTU9.js} +10 -10
- package/dist/{commands-registry-DxbSTLNQ.js → commands-registry-ByGkL6hs.js} +4 -4
- package/dist/{completion-cli-DgiFjSGS.js → completion-cli-BVTGy8th.js} +1 -1
- package/dist/{completion-cli-D9pC-ttw.js → completion-cli-Cf6fYZWL.js} +2 -2
- package/dist/{config-BkZ9HOKT.js → config-C4WnAd-c.js} +17 -17
- package/dist/{config-cli-C_uZQsTl.js → config-cli-C7DIbGxx.js} +1 -1
- package/dist/{config-cli-5mFA0UDP.js → config-cli-EgWrCemi.js} +1 -1
- package/dist/{configure-BJcy7wXm.js → configure-B67uIawm.js} +3 -3
- package/dist/{configure-DuRTFCuW.js → configure-Bk-snuxh.js} +3 -3
- package/dist/{consolidate-07QMweFF.js → consolidate-DRtVvG2U.js} +4 -4
- package/dist/{deliver-B0OUq6RP.js → deliver-SLYAWE19.js} +20 -20
- package/dist/{diagnostic-BUcR3Meg.js → diagnostic-DTkZsRNM.js} +1 -1
- package/dist/{doctor-completion-sQVhKKei.js → doctor-completion-By066O3p.js} +1 -1
- package/dist/{doctor-completion-DCRTHpiY.js → doctor-completion-lE_33xaY.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/{env-BDXYbTKj.js → env-CB65jmJQ.js} +1 -1
- package/dist/extensionAPI.js +2 -2
- package/dist/{frontmatter-CTR5f_Ez.js → frontmatter-CT1M0pRK.js} +4 -4
- package/dist/{gateway-cli-C3ujhxO0.js → gateway-cli-C6uT2x34.js} +182 -13
- package/dist/{gateway-cli-C_MT4JFm.js → gateway-cli-DqEgqVKC.js} +182 -13
- package/dist/{gemini-auth-BefM10YB.js → gemini-auth-D80BsXr2.js} +1 -1
- package/dist/{github-copilot-token-cCYzSU9h.js → github-copilot-token-B8B2pmph.js} +7 -7
- package/dist/{glass-ui-ws-ColAiWUr.js → glass-ui-ws-77TY57IO.js} +11 -11
- package/dist/{glass-ui-ws-B7zRY2BL.js → glass-ui-ws-CLAUHeZR.js} +11 -11
- package/dist/{health-C12hy3Ao.js → health-2jkjZxY8.js} +1 -1
- package/dist/{health-vKJZ7iJR.js → health-CvMHgR-L.js} +1 -1
- package/dist/{hooks-cli-CdUQvj8s.js → hooks-cli-CRZySOiz.js} +5 -5
- package/dist/{hooks-cli-fCPl5hur.js → hooks-cli-DSaezFsD.js} +5 -5
- package/dist/{image-BuVL0jHI.js → image-BHF_fnIp.js} +4 -4
- package/dist/{image-ops-C7CauEK8.js → image-ops-CY7v6vvp.js} +16 -16
- package/dist/index.js +9 -9
- package/dist/{internal-DjnxpF_K.js → internal-FNqguZSK.js} +11 -11
- package/dist/{ir-7tMVY7D_.js → ir-D6MiJpAy.js} +4 -4
- package/dist/llm-slug-generator.js +54 -54
- package/dist/{local-roots-ClipCZ9s.js → local-roots-tcdaIEhh.js} +5 -5
- package/dist/{login-D4rZWBXe.js → login-D4ZkmSrY.js} +7 -7
- package/dist/{login-qr-DdAVHOEC.js → login-qr-C9ftIq3n.js} +12 -12
- package/dist/{manager-DHRBy5oR.js → manager-BtWtmpxN.js} +1 -1
- package/dist/{manager-CLrJn9l-.js → manager-DDELj5o9.js} +1 -1
- package/dist/{manager-BJvYQ7xP.js → manager-DrmlegR2.js} +1 -1
- package/dist/{manager-Df_ZdrNG.js → manager-DxCmjSfP.js} +24 -24
- package/dist/{manifest-registry-CBCGTsIb.js → manifest-registry-BvGv6lp9.js} +19 -19
- package/dist/{markdown-tables-x2Xe2UXh.js → markdown-tables-CE-qSMGB.js} +1 -1
- package/dist/{memory-cli-T-a5-lqZ.js → memory-cli-ENCASZJk.js} +3 -3
- package/dist/{memory-cli-BgJciaHC.js → memory-cli-Qgbcxvuf.js} +3 -3
- package/dist/{message-channel-OlFBYAw8.js → message-channel-lwVT8QjK.js} +1 -1
- package/dist/{models-BXXV_sZU.js → models-COhUz7M9.js} +2 -2
- package/dist/{models-cli-BI-DyItH.js → models-cli-CCxYcF4R.js} +5 -5
- package/dist/{models-cli-Bs6JAGq-.js → models-cli-CYvXBvmZ.js} +6 -6
- package/dist/{onboard-Czi_FRdi.js → onboard-CQNUYBIp.js} +2 -2
- package/dist/{onboard-channels-sTuhQBVu.js → onboard-channels-9erx07qe.js} +1 -1
- package/dist/{onboard-channels-BUCYZF02.js → onboard-channels-CWw8G-6n.js} +1 -1
- package/dist/{onboard-DKDCWveE.js → onboard-fVpLVnwg.js} +2 -2
- package/dist/{onboarding-Bgx0qZhA.js → onboarding-CtEiH9WG.js} +3 -3
- package/dist/{onboarding-CokRRVEi.js → onboarding-D-OIkDwZ.js} +3 -3
- package/dist/{onboarding.finalize-BCv5jB0d.js → onboarding.finalize-BY3HNjX4.js} +9 -9
- package/dist/{onboarding.finalize-BzEKyraI.js → onboarding.finalize-DTbpLV-T.js} +8 -8
- package/dist/{outbound-Zmd7UyQH.js → outbound-C6Gm22UF.js} +7 -7
- package/dist/{outbound-attachment-DeCnZT-8.js → outbound-attachment-BWyKV1Gy.js} +2 -2
- package/dist/paths-CYmyCDsE.js +212 -0
- package/dist/{paths-CbQV9WEg.js → paths-DEuVuViW.js} +1 -1
- package/dist/{pi-auth-json-RXOlh8ar.js → pi-auth-json-Bv1NzJdR.js} +1 -1
- package/dist/{pi-embedded-DXY7TLac.js → pi-embedded-CdOdQw2i.js} +265 -13
- package/dist/{pi-embedded-helpers-D1_Sab0M.js → pi-embedded-helpers-DwQ9wJeT.js} +73 -73
- package/dist/{pi-tools.policy-BZrM6a-w.js → pi-tools.policy-Bx5zp45n.js} +2 -0
- package/dist/{pi-tools.policy-QIVWAVVI.js → pi-tools.policy-o0ytjRqu.js} +2 -0
- package/dist/{plugin-registry-CyrsJDyE.js → plugin-registry-BrJ0-qlu.js} +1 -1
- package/dist/{plugin-registry-B2cpTmJz.js → plugin-registry-Cuc8ORuR.js} +1 -1
- package/dist/plugin-sdk/agents/pi-embedded-runner/long-task-prompt.d.ts +7 -0
- package/dist/plugin-sdk/agents/tools/task-tool.d.ts +7 -0
- package/dist/plugin-sdk/{channel-web-t6enTxNE.js → channel-web-t8UOP6Zu.js} +1 -1
- package/dist/plugin-sdk/index.js +3 -3
- package/dist/plugin-sdk/{manager-LRE7zEk2.js → manager-BPm5oefC.js} +1 -1
- package/dist/plugin-sdk/{reply-JypoGhql.js → reply-BKAHTugL.js} +265 -13
- package/dist/plugin-sdk/{synthesis-_WpVyZKx.js → synthesis-CVF7Fwhd.js} +2 -2
- package/dist/plugin-sdk/{web-BTVj4kiQ.js → web-D0DsmFvw.js} +3 -3
- package/dist/{plugins-cli-B-zoQyqU.js → plugins-cli-BDalhI46.js} +5 -5
- package/dist/{plugins-cli-DJwRd3EZ.js → plugins-cli-DFmriy-c.js} +5 -5
- package/dist/{plugins-BzmbgY7s.js → plugins-v8k1XVOy.js} +9 -9
- package/dist/{program-H7h6Iqrq.js → program-DKh41c2a.js} +10 -10
- package/dist/{program-context-BgecQAHU.js → program-context-Cq7pqOrw.js} +19 -19
- package/dist/{prompt-select-styled-BglmD29e.js → prompt-select-styled-BFCAZLwK.js} +6 -6
- package/dist/{prompt-select-styled-BDN2o35i.js → prompt-select-styled-DvvSE_ni.js} +6 -6
- package/dist/{provider-auth-helpers-BGIgr7xM.js → provider-auth-helpers-B-LkDxxi.js} +1 -1
- package/dist/{provider-auth-helpers-MfKmTeLY.js → provider-auth-helpers-DXppgV1l.js} +1 -1
- package/dist/{push-apns-b6bH1EBC.js → push-apns-DCA47WA5.js} +1 -1
- package/dist/{push-apns-IcfSTzfr.js → push-apns-DvudhEAb.js} +1 -1
- package/dist/{pw-ai-DWkC5eGA.js → pw-ai-XGqnSWju.js} +11 -11
- package/dist/{qmd-manager-BXkbA8Y9.js → qmd-manager-CbRJhonG.js} +8 -8
- package/dist/{register.agent-ChwMSIC4.js → register.agent-_BV5KyFb.js} +9 -9
- package/dist/{register.agent-BgyETrrj.js → register.agent-aFj_SMi3.js} +8 -8
- package/dist/{register.configure-DH3L2tqW.js → register.configure-CvOoD5gE.js} +9 -9
- package/dist/{register.configure-Bm4CvoLF.js → register.configure-Dx0Uhmlz.js} +9 -9
- package/dist/{register.maintenance-BbOBw1eI.js → register.maintenance-BuZpoSik.js} +10 -10
- package/dist/{register.maintenance-CAyHUEzP.js → register.maintenance-CMeJR7DG.js} +11 -11
- package/dist/{register.message-DheqsiR0.js → register.message-qysZPg3G.js} +5 -5
- package/dist/{register.message-DQ3MOWFE.js → register.message-xxGePuRC.js} +5 -5
- package/dist/{register.onboard-DOJkUhoY.js → register.onboard-1MP2I0q4.js} +7 -7
- package/dist/{register.onboard-CxqR4S1C.js → register.onboard-D4Aow7Gc.js} +7 -7
- package/dist/{register.setup-zdrIJA2P.js → register.setup-BT74aXzA.js} +7 -7
- package/dist/{register.setup-48YBHzMZ.js → register.setup-DzliKkWh.js} +7 -7
- package/dist/{register.status-health-sessions-CeT5pVXb.js → register.status-health-sessions-B3K2gZ72.js} +7 -7
- package/dist/{register.status-health-sessions-CimrhScH.js → register.status-health-sessions-D7VYZlrU.js} +7 -7
- package/dist/{register.subclis-B-zh940S.js → register.subclis-BCy0IDRv.js} +10 -10
- package/dist/{registry-DYq1AYOv.js → registry-X6fUE0K7.js} +19 -19
- package/dist/{replies-CUWXgyx2.js → replies-86F3PldM.js} +3 -3
- package/dist/{reply-CUR4xpYM.js → reply-Dg1ZU3DZ.js} +263 -13
- package/dist/{reply-prefix-CvEIl6_d.js → reply-prefix-CI_IdwqH.js} +1 -1
- package/dist/{resolve-route-Jy5dFY67.js → resolve-route-BgSuN9c6.js} +4 -4
- package/dist/{retry-B-y5suGA.js → retry-4oEAHckB.js} +1 -1
- package/dist/{run-main-CW_kj5Lj.js → run-main-OS2aFAJ2.js} +18 -18
- package/dist/{runner-ecX1WzDt.js → runner-B5oNTtgf.js} +22 -22
- package/dist/{security-cli-BpnzAB5_.js → security-cli-BadXDWTh.js} +2 -2
- package/dist/{security-cli-D9WEiEjD.js → security-cli-D5y28-RH.js} +2 -2
- package/dist/{send-DFtnbzqy.js → send-ASDB3AzC.js} +7 -7
- package/dist/{send-Bb4it0te.js → send-BTfqlrYd.js} +18 -18
- package/dist/{send-C0QjmPaf.js → send-CSydU49L.js} +10 -10
- package/dist/{send-Cpk3Ti6-.js → send-Du-IfSne.js} +6 -6
- package/dist/{send-BKo1T3HF.js → send-cCTQjuOZ.js} +6 -6
- package/dist/{server-methods-C1h0A5n0.js → server-methods-BszFAkbJ.js} +8 -8
- package/dist/{server-methods-C4id-H_X.js → server-methods-D_iKJ-sj.js} +8 -8
- package/dist/{server-node-events-CD2yDaEj.js → server-node-events-CENHuAVz.js} +5 -5
- package/dist/{server-node-events-BPZEGV_N.js → server-node-events-uBu3XOjd.js} +5 -5
- package/dist/{session-BTeY6Gn2.js → session-D8qLj_xN.js} +8 -8
- package/dist/{skill-commands-DG2lcozb.js → skill-commands-BcOduw6G.js} +16 -16
- package/dist/{skills-CXxrn_e2.js → skills-BrYDT4Jr.js} +24 -24
- package/dist/{sqlite-BN_hIcmu.js → sqlite-P-gMg7fi.js} +3 -3
- package/dist/{status-_xBnHTlx.js → status-BvbJavmh.js} +1 -1
- package/dist/{status-DCeW2a07.js → status-CA0mUJld.js} +4 -4
- package/dist/{status-Cb932Vl4.js → status-CBnCPUMG.js} +4 -4
- package/dist/{status-DvHD1cnq.js → status-DJAeKN4G.js} +1 -1
- package/dist/{store-01F_JM7O.js → store-Ceagbc4L.js} +6 -6
- package/dist/{subagent-registry-BKuL9PdW.js → subagent-registry-C1OyZl-M.js} +263 -13
- package/dist/{subsystem-BjyjJF-d.js → subsystem-CzXhCdeY.js} +1 -1
- package/dist/{synthesis-DOiTUsXQ.js → synthesis-DNTyB7JY.js} +2 -2
- package/dist/{synthesis-BUqDGjlc.js → synthesis-DuqSkHEr.js} +54 -54
- package/dist/{synthesis-C9RputIi.js → synthesis-brHrnNF2.js} +4 -4
- package/dist/{synthesis-Ia9egx87.js → synthesis-z5B41p_r.js} +4 -4
- package/dist/{tables-DoG-pFrf.js → tables-qbCoZrYA.js} +1 -1
- package/dist/{target-errors-DeJTztcq.js → target-errors-uNitqCCT.js} +2 -2
- package/dist/{thinking-BprCy23Z.js → thinking-BV7SCNJP.js} +5 -5
- package/dist/{tokens-W0JzCJJM.js → tokens-Bl5R3wPD.js} +1 -1
- package/dist/{tool-images-SqqWIT22.js → tool-images-JxNglLSr.js} +2 -2
- package/dist/{tool-loop-detection-Dj9h1ogr.js → tool-loop-detection-dfE771kg.js} +3 -3
- package/dist/{unified-runner-CVItnwwP.js → unified-runner-Czg3pdBc.js} +489 -237
- package/dist/{update-cli-ChEABesZ.js → update-cli-0lyGyl31.js} +11 -11
- package/dist/{update-cli-D6ax3jSX.js → update-cli-CIzkVfmj.js} +10 -10
- package/dist/{update-runner-B2EY9BWM.js → update-runner-D7-LDziQ.js} +1 -1
- package/dist/{update-runner-CWG6GxKs.js → update-runner-aYPcKYAN.js} +1 -1
- package/dist/{web-z-yQ8riS.js → web-B90A99YU.js} +58 -58
- package/dist/{web-CpSE67Jp.js → web-BJ5dUZso.js} +5 -5
- package/dist/{web-D6PPeyG7.js → web-CN7wnU7w.js} +4 -4
- package/dist/{web-DMdb2p-h.js → web-Wk1ay1eQ.js} +2 -2
- package/dist/{whatsapp-actions-DmVpLXmh.js → whatsapp-actions-llk0IUn2.js} +23 -23
- package/dist/{workspace-DscDraUb.js → workspace-CywO4ayZ.js} +27 -27
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/learning-loop/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +12 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +12 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +12 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/outlook/package.json +1 -1
- package/extensions/pipeline/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +12 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +12 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +12 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +12 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
- package/skills/long-task/scripts/detach-task.sh +57 -5
package/package.json
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
# → "aborted rc=<N> signal=<NAME>" on SIGTERM/INT/HUP
|
|
16
16
|
#
|
|
17
17
|
# Exit code: 0 on successful spawn, 1 on missing args, 2 on invalid args,
|
|
18
|
-
# 3 on workdir creation failure
|
|
18
|
+
# 3 on workdir creation failure, 4 on task-id collision (a task
|
|
19
|
+
# with the same id is already running).
|
|
19
20
|
#
|
|
20
21
|
# Hardening notes (2.7.0):
|
|
21
22
|
# - task-id is validated against an allow-list ([a-zA-Z0-9._-], 1–60 chars,
|
|
@@ -27,6 +28,14 @@
|
|
|
27
28
|
# - Child shell has a TERM/INT/HUP trap that records an "aborted" status
|
|
28
29
|
# before exiting, so external kill signals leave a deterministic record.
|
|
29
30
|
#
|
|
31
|
+
# Hardening notes (post-2.8.12):
|
|
32
|
+
# - Pre-flight collision check: refuses to overwrite the state files of a
|
|
33
|
+
# task-id whose recorded PID is still alive (exit code 4).
|
|
34
|
+
# - Log file is bounded by LONG_TASK_LOG_MAX_BYTES (default 104857600 =
|
|
35
|
+
# 100 MiB; override via env). Once exceeded, a single marker line is
|
|
36
|
+
# written and further output is silently discarded — the producer keeps
|
|
37
|
+
# running, never gets SIGPIPE.
|
|
38
|
+
#
|
|
30
39
|
# Design notes:
|
|
31
40
|
# - setsid + nohup + disown: triple-armor against SIGHUP when the parent
|
|
32
41
|
# shell exits. The subprocess gets its own session.
|
|
@@ -75,12 +84,31 @@ if ! mkdir -p "$workdir"; then
|
|
|
75
84
|
exit 3
|
|
76
85
|
fi
|
|
77
86
|
|
|
87
|
+
# --- log size cap -----------------------------------------------------------
|
|
88
|
+
log_max_bytes="${LONG_TASK_LOG_MAX_BYTES:-104857600}"
|
|
89
|
+
if ! [[ "$log_max_bytes" =~ ^[0-9]+$ ]] || (( log_max_bytes < 1 )); then
|
|
90
|
+
echo "detach-task: LONG_TASK_LOG_MAX_BYTES must be a positive integer (got: $log_max_bytes)" >&2
|
|
91
|
+
exit 2
|
|
92
|
+
fi
|
|
93
|
+
|
|
78
94
|
pid_file="$workdir/task-${task_id}.pid"
|
|
79
95
|
cmd_file="$workdir/task-${task_id}.cmd"
|
|
80
96
|
started_file="$workdir/task-${task_id}.started"
|
|
81
97
|
log_file="$workdir/task-${task_id}.log"
|
|
82
98
|
status_file="$workdir/task-${task_id}.status"
|
|
83
99
|
|
|
100
|
+
# --- collision check --------------------------------------------------------
|
|
101
|
+
# If a pid file exists and the recorded PID is still alive, a prior task with
|
|
102
|
+
# this id is already running. Refuse to clobber its log/status files.
|
|
103
|
+
# Stale pid files (process already dead) are silently overwritten below.
|
|
104
|
+
if [[ -f "$pid_file" ]]; then
|
|
105
|
+
prior_pid="$(tr -dc '0-9' < "$pid_file" 2>/dev/null || true)"
|
|
106
|
+
if [[ -n "$prior_pid" ]] && kill -0 "$prior_pid" 2>/dev/null; then
|
|
107
|
+
echo "detach-task: task-id '$task_id' is already running (pid=$prior_pid). Pick a different id or wait for it to finish." >&2
|
|
108
|
+
exit 4
|
|
109
|
+
fi
|
|
110
|
+
fi
|
|
111
|
+
|
|
84
112
|
# --- atomic status writer (parent) -----------------------------------------
|
|
85
113
|
write_status_atomic() {
|
|
86
114
|
local _payload="$1"
|
|
@@ -104,7 +132,8 @@ setsid nohup bash -c '
|
|
|
104
132
|
set -u
|
|
105
133
|
_status="$1"
|
|
106
134
|
_log="$2"
|
|
107
|
-
|
|
135
|
+
_max="$3"
|
|
136
|
+
shift 3
|
|
108
137
|
_write() {
|
|
109
138
|
local _tmp="${_status}.$$.${RANDOM}.tmp"
|
|
110
139
|
printf "%s\n" "$1" > "$_tmp" && mv -f "$_tmp" "$_status"
|
|
@@ -115,13 +144,36 @@ setsid nohup bash -c '
|
|
|
115
144
|
_write "aborted rc=$_rc signal=$_sig ended=$(date -u -Iseconds)" 2>/dev/null || true
|
|
116
145
|
exit "$_rc"
|
|
117
146
|
}
|
|
147
|
+
# Reads stdin line-by-line, prints to its stdout (which the caller
|
|
148
|
+
# redirects to the log file) up to _max total bytes, then writes one
|
|
149
|
+
# cap marker and silently discards the rest. Reading continues until
|
|
150
|
+
# EOF so the producing pipe never receives SIGPIPE.
|
|
151
|
+
_log_capper() {
|
|
152
|
+
local _total=0
|
|
153
|
+
local _capped=0
|
|
154
|
+
local _line
|
|
155
|
+
local _ls
|
|
156
|
+
while IFS= read -r _line; do
|
|
157
|
+
if (( _capped )); then
|
|
158
|
+
continue
|
|
159
|
+
fi
|
|
160
|
+
_ls=$(( ${#_line} + 1 ))
|
|
161
|
+
if (( _total + _ls > _max )); then
|
|
162
|
+
printf "[long-task: log capped at %s bytes; further output discarded]\n" "$_max"
|
|
163
|
+
_capped=1
|
|
164
|
+
continue
|
|
165
|
+
fi
|
|
166
|
+
printf "%s\n" "$_line"
|
|
167
|
+
_total=$(( _total + _ls ))
|
|
168
|
+
done
|
|
169
|
+
}
|
|
118
170
|
trap "_on_signal TERM" TERM
|
|
119
171
|
trap "_on_signal INT" INT
|
|
120
172
|
trap "_on_signal HUP" HUP
|
|
121
|
-
"$@"
|
|
122
|
-
rc
|
|
173
|
+
"$@" 2>&1 | _log_capper >> "$_log"
|
|
174
|
+
rc=${PIPESTATUS[0]}
|
|
123
175
|
_write "complete rc=$rc ended=$(date -u -Iseconds)"
|
|
124
|
-
' -- "$status_file" "$log_file" "$@" < /dev/null > /dev/null 2>&1 &
|
|
176
|
+
' -- "$status_file" "$log_file" "$log_max_bytes" "$@" < /dev/null > /dev/null 2>&1 &
|
|
125
177
|
|
|
126
178
|
pid=$!
|
|
127
179
|
disown "$pid" 2>/dev/null || true
|