mixdog 0.9.152 → 0.9.154
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/LICENSES/browser-import-NOTICE.txt +11 -0
- package/NOTICE.md +11 -0
- package/README.md +8 -10
- package/package.json +19 -3
- package/scripts/computer-task-cost-report.mjs +144 -0
- package/scripts/run-office-live-tests.mjs +32 -0
- package/src/agents/front-worker/AGENT.md +13 -0
- package/src/agents/front-worker/agent.json +6 -0
- package/src/agents/heavy-worker/AGENT.md +10 -11
- package/src/agents/heavy-worker/agent.json +1 -1
- package/src/agents/maintainer/AGENT.md +0 -2
- package/src/agents/reviewer/AGENT.md +9 -13
- package/src/agents/reviewer/agent.json +1 -1
- package/src/agents/security/AGENT.md +14 -0
- package/src/agents/security/agent.json +6 -0
- package/src/agents/worker/AGENT.md +8 -8
- package/src/agents/worker/agent.json +1 -1
- package/src/agents/writer/AGENT.md +14 -0
- package/src/agents/writer/agent.json +6 -0
- package/src/rules/agent/00-common.md +4 -7
- package/src/rules/lead/01-general.md +0 -3
- package/src/rules/shared/10-tool-workflow.md +10 -2
- package/src/rules/shared/60-verification.md +2 -0
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +183 -26
- package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +4 -0
- package/src/runtime/agent/orchestrator/cache-break-trace.mjs +109 -0
- package/src/runtime/agent/orchestrator/config.mjs +7 -2
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +16 -3
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +9 -1
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +30 -9
- package/src/runtime/agent/orchestrator/providers/openai-codex-metadata.mjs +18 -26
- package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +25 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +103 -10
- package/src/runtime/agent/orchestrator/providers/openai-turn-state.mjs +68 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +36 -11
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +140 -86
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +9 -13
- package/src/runtime/agent/orchestrator/session/agent-loop.mjs +72 -4
- package/src/runtime/agent/orchestrator/session/browser-snapshot-supersession.mjs +61 -0
- package/src/runtime/agent/orchestrator/session/compact/handoff.mjs +0 -22
- package/src/runtime/agent/orchestrator/session/compact/messages.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +11 -23
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +28 -269
- package/src/runtime/agent/orchestrator/session/compact.mjs +0 -6
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +86 -11
- package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +17 -1
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.mjs +12 -8
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +110 -2
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +3 -16
- package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +80 -18
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +80 -21
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +33 -72
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +21 -2
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +25 -51
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +4 -110
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +39 -15
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +14 -4
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +41 -8
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.mjs +129 -12
- package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/store/listing.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +15 -1
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +36 -2
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +157 -30
- package/src/runtime/agent/orchestrator/session/store-summary-visibility.mjs +57 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/tool-batch.mjs +22 -0
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +6 -6
- package/src/runtime/agent/orchestrator/tools/progress-message.mjs +4 -0
- package/src/runtime/attachments/pdf-extract.mjs +3 -0
- package/src/runtime/attachments/pdfjs-runtime.mjs +13 -0
- package/src/runtime/browser-bridge/action-schema.mjs +251 -0
- package/src/runtime/browser-bridge/client.mjs +75 -26
- package/src/runtime/browser-bridge/tool-defs.mjs +132 -15
- package/src/runtime/computer-bridge/action-schema.mjs +653 -0
- package/src/runtime/computer-bridge/client.mjs +211 -28
- package/src/runtime/computer-bridge/tool-defs.mjs +25 -45
- package/src/runtime/office/assurance-benchmark.mjs +358 -0
- package/src/runtime/office/assurance.mjs +833 -0
- package/src/runtime/office/benchmark.mjs +496 -0
- package/src/runtime/office/capabilities.mjs +551 -0
- package/src/runtime/office/com-adapter.mjs +283 -0
- package/src/runtime/office/content-model.mjs +183 -0
- package/src/runtime/office/contract-benchmark.mjs +105 -0
- package/src/runtime/office/design-library.mjs +1562 -0
- package/src/runtime/office/design-system.mjs +1966 -0
- package/src/runtime/office/index.mjs +2413 -0
- package/src/runtime/office/journal.mjs +82 -0
- package/src/runtime/office/office-com-host.ps1 +3781 -0
- package/src/runtime/office/office-com-session-host.ps1 +855 -0
- package/src/runtime/office/ooxml-validator.mjs +271 -0
- package/src/runtime/office/pagination.mjs +132 -0
- package/src/runtime/office/pdf-adapter.mjs +591 -0
- package/src/runtime/office/pdf-analysis.mjs +372 -0
- package/src/runtime/office/pdf-render.mjs +167 -0
- package/src/runtime/office/pdf-security.mjs +63 -0
- package/src/runtime/office/polish-benchmark.mjs +190 -0
- package/src/runtime/office/portable-ooxml.mjs +1867 -0
- package/src/runtime/office/quality-live-benchmark.mjs +486 -0
- package/src/runtime/office/quality-pipeline.mjs +136 -0
- package/src/runtime/office/tabular.mjs +302 -0
- package/src/runtime/office/templates/mixdog-executive.pptx +0 -0
- package/src/runtime/office/templates/mixdog-executive.pptx.mixdog.json +190 -0
- package/src/runtime/office/tool-defs.mjs +113 -0
- package/src/runtime/office/visual-diff.mjs +89 -0
- package/src/runtime/office/xlsx-assertions.mjs +172 -0
- package/src/runtime/office/xlsx-contract.mjs +147 -0
- package/src/runtime/shared/agent-route-config.mjs +9 -0
- package/src/runtime/shared/tool-execution-contract.mjs +16 -0
- package/src/runtime/shared/tool-surface.mjs +9 -0
- package/src/session-runtime/context-status.mjs +9 -3
- package/src/session-runtime/deferred-tool-delta.mjs +104 -0
- package/src/session-runtime/goal-runtime.mjs +617 -197
- package/src/session-runtime/lifecycle-api.mjs +50 -8
- package/src/session-runtime/provider-request-snapshot.mjs +33 -9
- package/src/session-runtime/resource-api.mjs +31 -94
- package/src/session-runtime/runtime-core.mjs +78 -26
- package/src/session-runtime/session-lifecycle.mjs +34 -12
- package/src/session-runtime/session-title.mjs +2 -2
- package/src/session-runtime/session-turn-api.mjs +15 -14
- package/src/session-runtime/tool-catalog-data.mjs +1 -1
- package/src/session-runtime/tool-catalog.mjs +38 -99
- package/src/session-runtime/tool-defs.mjs +6 -1
- package/src/session-runtime/tool-surface.mjs +18 -8
- package/src/session-runtime/workflow-agents-api.mjs +8 -25
- package/src/session-runtime/workflow.mjs +8 -6
- package/src/standalone/agent-tool/helpers.mjs +2 -2
- package/src/standalone/agent-tool/job-views.mjs +3 -1
- package/src/standalone/agent-tool/notify.mjs +5 -1
- package/src/standalone/agent-tool/render.mjs +3 -0
- package/src/standalone/agent-tool/spawn-flow.mjs +61 -16
- package/src/standalone/agent-tool/tool-def.mjs +1 -1
- package/src/standalone/agent-tool/worker-index.mjs +123 -0
- package/src/standalone/agent-tool/worker-rows.mjs +2 -1
- package/src/standalone/agent-tool.mjs +57 -10
- package/src/standalone/daemon.mjs +105 -6
- package/src/standalone/session-runtime-host.mjs +61 -48
- package/src/standalone/session-runtime-inline-host.mjs +34 -127
- package/src/standalone/session-runtime-worker.mjs +20 -198
- package/src/standalone/session-service.mjs +632 -7
- package/src/tui/dist/index.mjs +24 -1
- package/src/tui/lib/voice-setup.mjs +4 -1
- package/src/tui/session/context-state.mjs +2 -13
- package/src/tui/session/goal-continuation.mjs +38 -7
- package/src/tui/session/session-api-ext.mjs +9 -0
- package/src/tui/session/session-api.mjs +15 -1
- package/src/tui/session/session-flow.mjs +25 -1
- package/src/tui/session/turn.mjs +88 -16
- package/src/tui/session-local.mjs +25 -3
- package/src/vendor/statusline/src/gateway/route-meta.mjs +31 -0
- package/scripts/generate-voice-runtime-manifest.test.mjs +0 -135
- package/scripts/native-binary-arch.test.mjs +0 -111
- package/scripts/patch-replay.test.mjs +0 -94
- package/src/headless-exec.test.mjs +0 -539
- package/src/runtime/agent/orchestrator/agent-trace-timing.test.mjs +0 -57
- package/src/runtime/agent/orchestrator/context/collect-skills.test.mjs +0 -153
- package/src/runtime/agent/orchestrator/mcp/cancellation.test.mjs +0 -139
- package/src/runtime/agent/orchestrator/mcp/features.test.mjs +0 -66
- package/src/runtime/agent/orchestrator/mcp/security.test.mjs +0 -80
- package/src/runtime/agent/orchestrator/providers/anthropic-fast-mode.test.mjs +0 -90
- package/src/runtime/agent/orchestrator/providers/anthropic-server-fallback.test.mjs +0 -215
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth.test.mjs +0 -165
- package/src/runtime/agent/orchestrator/providers/media-parity.test.mjs +0 -142
- package/src/runtime/agent/orchestrator/providers/openai-codex-identity.test.mjs +0 -153
- package/src/runtime/agent/orchestrator/providers/openai-codex-model.test.mjs +0 -24
- package/src/runtime/agent/orchestrator/providers/openai-ws-delta-parity.test.mjs +0 -190
- package/src/runtime/agent/orchestrator/providers/provider-replay.test.mjs +0 -235
- package/src/runtime/agent/orchestrator/providers/sse-framing.test.mjs +0 -719
- package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.test.mjs +0 -40
- package/src/runtime/agent/orchestrator/session/compact-policy.test.mjs +0 -176
- package/src/runtime/agent/orchestrator/session/compaction-read-reset.test.mjs +0 -161
- package/src/runtime/agent/orchestrator/session/eager-dispatch.test.mjs +0 -115
- package/src/runtime/agent/orchestrator/session/evidence-union.test.mjs +0 -228
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.test.mjs +0 -245
- package/src/runtime/agent/orchestrator/session/lossless-tool-output.test.mjs +0 -125
- package/src/runtime/agent/orchestrator/session/manager/pending-messages-persistence.test.mjs +0 -325
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.test.mjs +0 -70
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.test.mjs +0 -457
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.test.mjs +0 -117
- package/src/runtime/agent/orchestrator/session/reduction-metrics.test.mjs +0 -87
- package/src/runtime/agent/orchestrator/session/store/serialize.test.mjs +0 -60
- package/src/runtime/agent/orchestrator/session/store-summary-reader.test.mjs +0 -583
- package/src/runtime/agent/orchestrator/session/task-wait-control.test.mjs +0 -78
- package/src/runtime/agent/orchestrator/tools/builtin/absence-absorption.test.mjs +0 -43
- package/src/runtime/agent/orchestrator/tools/builtin/absolute-glob-expand.test.mjs +0 -63
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool-cwd-env.test.mjs +0 -14
- package/src/runtime/agent/orchestrator/tools/builtin/edit-encoding-eol.test.mjs +0 -224
- package/src/runtime/agent/orchestrator/tools/builtin/edit-sequential-occupation.test.mjs +0 -224
- package/src/runtime/agent/orchestrator/tools/builtin/enoent-outside-project.test.mjs +0 -56
- package/src/runtime/agent/orchestrator/tools/builtin/find-search-budget.test.mjs +0 -103
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.test.mjs +0 -30
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.test.mjs +0 -390
- package/src/runtime/agent/orchestrator/tools/builtin/git-repo-rw-lock.test.mjs +0 -83
- package/src/runtime/agent/orchestrator/tools/builtin/grep-output-budget.test.mjs +0 -31
- package/src/runtime/agent/orchestrator/tools/builtin/grep-single-file-rescue.test.mjs +0 -106
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.test.mjs +0 -102
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool-integrity.test.mjs +0 -152
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-health.test.mjs +0 -24
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-transport.test.mjs +0 -24
- package/src/runtime/agent/orchestrator/tools/builtin/noise-dir-visibility.test.mjs +0 -69
- package/src/runtime/agent/orchestrator/tools/builtin/read-glob-survey.test.mjs +0 -71
- package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.test.mjs +0 -56
- package/src/runtime/agent/orchestrator/tools/builtin/search-builders.test.mjs +0 -16
- package/src/runtime/agent/orchestrator/tools/builtin/search-glob-top-k.test.mjs +0 -39
- package/src/runtime/agent/orchestrator/tools/builtin/write-symlink.test.mjs +0 -153
- package/src/runtime/agent/orchestrator/tools/code-graph/aggregate-anchor-relocation.test.mjs +0 -55
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.test.mjs +0 -88
- package/src/runtime/agent/orchestrator/tools/code-graph/loose-file-target.test.mjs +0 -72
- package/src/runtime/agent/orchestrator/tools/code-graph/memory-cache.test.mjs +0 -54
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.test.mjs +0 -20
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-search-scope.test.mjs +0 -55
- package/src/runtime/agent/orchestrator/tools/code-graph/text-span-mask.test.mjs +0 -268
- package/src/runtime/agent/orchestrator/tools/env-scrub.test.mjs +0 -57
- package/src/runtime/agent/orchestrator/tools/graph-binary-fetcher.test.mjs +0 -19
- package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.test.mjs +0 -104
- package/src/runtime/agent/orchestrator/tools/patch/engine-contract-gate.test.mjs +0 -661
- package/src/runtime/agent/orchestrator/tools/patch/patch-codec-eol.test.mjs +0 -552
- package/src/runtime/agent/orchestrator/tools/patch/patch-symlink.test.mjs +0 -141
- package/src/runtime/agent/orchestrator/tools/patch/v4a-pure-move.test.mjs +0 -57
- package/src/runtime/agent/orchestrator/tools/patch/v4a-section-coalesce.test.mjs +0 -81
- package/src/runtime/agent/orchestrator/tools/spawn-binary-fetcher.test.mjs +0 -52
- package/src/runtime/attachments/store.test.mjs +0 -209
- package/src/runtime/channels/lib/voice-runtime-fetcher.test.mjs +0 -17
- package/src/runtime/channels/lib/webhook/deliveries.test.mjs +0 -18
- package/src/runtime/channels/lib/webhook/relay-tunnel.test.mjs +0 -68
- package/src/runtime/media/adapters/codex-image.test.mjs +0 -22
- package/src/runtime/media/download.test.mjs +0 -52
- package/src/runtime/media/renditions.test.mjs +0 -99
- package/src/runtime/media/store.test.mjs +0 -159
- package/src/runtime/memory/lib/archive-security.test.mjs +0 -128
- package/src/runtime/memory/lib/embedding-model-config.test.mjs +0 -33
- package/src/runtime/memory/lib/http-wire.test.mjs +0 -15
- package/src/runtime/memory/lib/memory-cycle-packets.test.mjs +0 -49
- package/src/runtime/memory/lib/memory-cycle2-shared.test.mjs +0 -78
- package/src/runtime/memory/lib/memory-embedding-migration.test.mjs +0 -50
- package/src/runtime/memory/lib/pg/process.test.mjs +0 -36
- package/src/runtime/memory/lib/trace-store.test.mjs +0 -57
- package/src/runtime/memory/lib/transcript-ingest.test.mjs +0 -52
- package/src/runtime/shared/background-tasks.test.mjs +0 -78
- package/src/runtime/shared/bounded-download.test.mjs +0 -41
- package/src/runtime/shared/channel-notification-routing.test.mjs +0 -25
- package/src/runtime/shared/child-spawn-remote.test.mjs +0 -124
- package/src/runtime/shared/remote-intent.test.mjs +0 -40
- package/src/runtime/shared/resource-admission.test.mjs +0 -43
- package/src/runtime/shared/runtime-root.test.mjs +0 -34
- package/src/runtime/shared/schedule-time.test.mjs +0 -29
- package/src/runtime/shared/session-runtime-health.test.mjs +0 -83
- package/src/runtime/shared/skill-document.test.mjs +0 -81
- package/src/runtime/shared/tool-surface.test.mjs +0 -87
- package/src/runtime/shared/update-checker.test.mjs +0 -33
- package/src/runtime/shared/user-cwd.test.mjs +0 -43
- package/src/runtime/shared/webhook-session-run.test.mjs +0 -14
- package/src/session-runtime/agent-disable.test.mjs +0 -123
- package/src/session-runtime/cwd-plugins.test.mjs +0 -75
- package/src/session-runtime/cwd-tool-routing.test.mjs +0 -61
- package/src/session-runtime/global-extensions.test.mjs +0 -28
- package/src/session-runtime/goal-runtime.test.mjs +0 -108
- package/src/session-runtime/lifecycle-api.test.mjs +0 -21
- package/src/session-runtime/model-settings-persist.test.mjs +0 -105
- package/src/session-runtime/notification-bus.test.mjs +0 -148
- package/src/session-runtime/plugin-mcp-standard.test.mjs +0 -177
- package/src/session-runtime/prewarm.test.mjs +0 -52
- package/src/session-runtime/provider-request-snapshot.test.mjs +0 -37
- package/src/session-runtime/resource-api-global.test.mjs +0 -69
- package/src/session-runtime/session-lifecycle.test.mjs +0 -125
- package/src/session-runtime/session-title.test.mjs +0 -36
- package/src/session-runtime/skills-api.test.mjs +0 -99
- package/src/session-runtime/tool-policy-surface.test.mjs +0 -331
- package/src/standalone/agent-tool/helpers.test.mjs +0 -62
- package/src/standalone/agent-tool/notify.test.mjs +0 -37
- package/src/standalone/agent-tool/spawn-flow.test.mjs +0 -63
- package/src/standalone/channel-restart.test.mjs +0 -145
- package/src/standalone/channel-session-router.test.mjs +0 -37
- package/src/standalone/channel-worker-heartbeat.test.mjs +0 -30
- package/src/standalone/hook-bus/handlers.test.mjs +0 -88
- package/src/standalone/plugin-admin.test.mjs +0 -173
- package/src/standalone/session-runtime-agent-control-client.test.mjs +0 -71
- package/src/standalone/session-runtime-dispatch-cancel.test.mjs +0 -139
- package/src/standalone/session-runtime-host-factory.test.mjs +0 -31
- package/src/standalone/session-runtime-host-health.test.mjs +0 -160
- package/src/standalone/session-runtime-inline-host.test.mjs +0 -83
- package/src/standalone/session-runtime-provider-cooldown.test.mjs +0 -80
- package/src/standalone/session-runtime-shard-host.test.mjs +0 -569
- package/src/standalone/session-runtime-shard-router.test.mjs +0 -101
- package/src/tui/app/live-spinner-visibility.test.mjs +0 -44
- package/src/tui/app/panel-epoch.test.mjs +0 -1009
- package/src/tui/app/panel-handoff.test.mjs +0 -311
- package/src/tui/app/prompt-submit.test.mjs +0 -206
- package/src/tui/session/completion-card-restore.test.mjs +0 -111
- package/src/tui/session/goal-continuation.test.mjs +0 -84
- package/src/tui/session/oauth-flows.test.mjs +0 -134
- package/src/tui/session/queue-helpers.test.mjs +0 -46
- package/src/tui/session/session-action-surface.test.mjs +0 -108
- package/src/tui/session/task-wait-submit.test.mjs +0 -80
- package/src/tui/session/tool-result-status.test.mjs +0 -131
- package/src/tui/session/tui-steering-persist.test.mjs +0 -104
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { test } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
|
|
4
|
-
import { _inferSpanEndByIndent } from './span.mjs';
|
|
5
|
-
import { _maskNonCodeText } from './text-mask.mjs';
|
|
6
|
-
import { _atJsRegexPosition, _extractCallees, _jsBraceKindAt } from './search.mjs';
|
|
7
|
-
|
|
8
|
-
test('indentation span inference keeps a multiline arrow signature whole', () => {
|
|
9
|
-
const lines = [
|
|
10
|
-
'const handler = (',
|
|
11
|
-
' a,',
|
|
12
|
-
' b,',
|
|
13
|
-
') => {',
|
|
14
|
-
' return a + b;',
|
|
15
|
-
'};',
|
|
16
|
-
];
|
|
17
|
-
assert.equal(_inferSpanEndByIndent(lines, 1), 6);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test('indentation span inference still ends at a plain matching closer', () => {
|
|
21
|
-
const lines = [
|
|
22
|
-
'const rows = [',
|
|
23
|
-
' 1,',
|
|
24
|
-
' 2,',
|
|
25
|
-
'];',
|
|
26
|
-
'const other = 3;',
|
|
27
|
-
];
|
|
28
|
-
assert.equal(_inferSpanEndByIndent(lines, 1), 4);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test('python f-string interpolation keeps its call visible', () => {
|
|
32
|
-
const masked = _maskNonCodeText('x = f"total {compute_total(rows)} done"\n', 'python');
|
|
33
|
-
assert.match(masked, /compute_total\(rows\)/);
|
|
34
|
-
assert.doesNotMatch(masked, /done/);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('C# interpolated string exposes the call and keeps {{ }} literal', () => {
|
|
38
|
-
const masked = _maskNonCodeText('var s = $"{Compute(x)} {{literal}}";\n', 'csharp');
|
|
39
|
-
assert.match(masked, /Compute\(x\)/);
|
|
40
|
-
assert.doesNotMatch(masked, /literal/);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('kotlin string template exposes the call', () => {
|
|
44
|
-
const masked = _maskNonCodeText('val s = "n=${computeTotal(rows)}"\n', 'kotlin');
|
|
45
|
-
assert.match(masked, /computeTotal\(rows\)/);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('bash command substitution inside double quotes stays code', () => {
|
|
49
|
-
const masked = _maskNonCodeText('echo "value $(compute_total rows) done"\n', 'bash');
|
|
50
|
-
assert.match(masked, /compute_total rows/);
|
|
51
|
-
assert.doesNotMatch(masked, /value/);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('a plain python string is still fully masked', () => {
|
|
55
|
-
const masked = _maskNonCodeText('x = "total {compute_total(rows)} done"\n', 'python');
|
|
56
|
-
assert.doesNotMatch(masked, /compute_total/);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('a python triple-quoted f-string interpolates', () => {
|
|
60
|
-
const masked = _maskNonCodeText('x = f"""head {compute(rows)} tail"""\n', 'python');
|
|
61
|
-
assert.match(masked, /compute\(rows\)/);
|
|
62
|
-
assert.doesNotMatch(masked, /head/);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('a kotlin raw string template interpolates', () => {
|
|
66
|
-
const masked = _maskNonCodeText('val s = """head ${compute(rows)} tail"""\n', 'kotlin');
|
|
67
|
-
assert.match(masked, /compute\(rows\)/);
|
|
68
|
-
assert.doesNotMatch(masked, /head/);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('a kotlin bare $name keeps the identifier but a JS template does not', () => {
|
|
72
|
-
const kotlin = _maskNonCodeText('val s = "id=$userId done"\n', 'kotlin');
|
|
73
|
-
assert.match(kotlin, /userId/);
|
|
74
|
-
assert.doesNotMatch(kotlin, /done/);
|
|
75
|
-
|
|
76
|
-
// JS template literals have no bare form: `$userId` is literal text.
|
|
77
|
-
const js = _maskNonCodeText('const s = `id=$userId`;\n', 'javascript');
|
|
78
|
-
assert.doesNotMatch(js, /userId/);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('a non-matching same-indent closer does not end the span', () => {
|
|
82
|
-
const lines = [
|
|
83
|
-
'const handler = {',
|
|
84
|
-
' run: (',
|
|
85
|
-
' ) => 1,',
|
|
86
|
-
')',
|
|
87
|
-
'};',
|
|
88
|
-
];
|
|
89
|
-
assert.equal(_inferSpanEndByIndent(lines, 1), 5);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
test('a division after an object literal is not read as a regex', () => {
|
|
93
|
-
const text = 'function f(){ const x = {} / 2; } outside();';
|
|
94
|
-
assert.equal(_atJsRegexPosition(text, text.indexOf('/ 2')), false);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test('a statement-position regex after a closing brace is recognized', () => {
|
|
98
|
-
const text = '}\n/re/.test(x)';
|
|
99
|
-
assert.equal(_atJsRegexPosition(text, text.indexOf('/re/')), true);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test('a postfix increment before a slash stays division', () => {
|
|
103
|
-
const text = 'const y = a++ / b;';
|
|
104
|
-
assert.equal(_atJsRegexPosition(text, text.indexOf('/ b')), false);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('brace kinds separate object literals from blocks', () => {
|
|
108
|
-
assert.equal(_jsBraceKindAt('const x = {}', 10), 'object');
|
|
109
|
-
assert.equal(_jsBraceKindAt('call({})', 5), 'object');
|
|
110
|
-
assert.equal(_jsBraceKindAt('return {}', 7), 'object');
|
|
111
|
-
// Property value: the scanner passes the ENCLOSING brace kind, which is
|
|
112
|
-
// what separates `{ key: {…} }` from a labeled block.
|
|
113
|
-
assert.equal(_jsBraceKindAt('const y = { a: {} }', 15, null, 'object'), 'object');
|
|
114
|
-
// Grammatical position, not a character list: unary `!` and binary `-`.
|
|
115
|
-
assert.equal(_jsBraceKindAt('!{}', 1), 'object');
|
|
116
|
-
assert.equal(_jsBraceKindAt('1 - {}', 4), 'object');
|
|
117
|
-
assert.equal(_jsBraceKindAt('function f() {}', 13), 'block');
|
|
118
|
-
assert.equal(_jsBraceKindAt('const f = () => {}', 16), 'block');
|
|
119
|
-
assert.equal(_jsBraceKindAt('if (x) {}', 7), 'block');
|
|
120
|
-
assert.equal(_jsBraceKindAt('do {} while (x)', 3), 'block');
|
|
121
|
-
assert.equal(_jsBraceKindAt('if (x) {} else {}', 15), 'block');
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('object-literal divisions after ! and - do not swallow the rest of the file', () => {
|
|
125
|
-
for (const body of ['!{} / 2;', '1 - {} / 2;']) {
|
|
126
|
-
const rel = 'probe-op.mjs';
|
|
127
|
-
const text = `function f(){ ${body} } outside();\n`;
|
|
128
|
-
const node = {
|
|
129
|
-
rel,
|
|
130
|
-
abs: rel,
|
|
131
|
-
lang: 'javascript',
|
|
132
|
-
fingerprint: '',
|
|
133
|
-
symbols: [],
|
|
134
|
-
topLevelTypes: [],
|
|
135
|
-
resolvedImports: [],
|
|
136
|
-
rawImports: [],
|
|
137
|
-
};
|
|
138
|
-
const graph = {
|
|
139
|
-
nodes: new Map([[rel, node]]),
|
|
140
|
-
reverse: new Map(),
|
|
141
|
-
_sourceTextCache: new Map([[rel, { fingerprint: '', text }]]),
|
|
142
|
-
_sourceLinesCache: new Map(),
|
|
143
|
-
_maskedLinesCache: new Map(),
|
|
144
|
-
};
|
|
145
|
-
const rows = _extractCallees(
|
|
146
|
-
graph,
|
|
147
|
-
{ rel, lang: 'javascript', line: 1, col: 1, declarationLike: true },
|
|
148
|
-
'.',
|
|
149
|
-
{ callerSymbol: 'f' },
|
|
150
|
-
);
|
|
151
|
-
assert.deepEqual(rows.map((row) => row.name), [], `body: ${body}`);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
test('a labeled block is a block, an object property and a ternary are values', () => {
|
|
156
|
-
assert.equal(_jsBraceKindAt('label: {}', 7, null, 'block'), 'block');
|
|
157
|
-
assert.equal(_jsBraceKindAt('({ key: {} })', 8, null, 'object'), 'object');
|
|
158
|
-
assert.equal(_jsBraceKindAt('const v = c ? a : {};', 18, null, 'block'), 'object');
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
test('a case label with a ternary expression still opens a block', () => {
|
|
162
|
-
const src = 'switch (v) { case c ? a : b: {} }';
|
|
163
|
-
assert.equal(_jsBraceKindAt(src, src.indexOf('{}'), null, 'block'), 'block');
|
|
164
|
-
const plain = 'switch (v) { case 1: {} }';
|
|
165
|
-
assert.equal(_jsBraceKindAt(plain, plain.indexOf('{}'), null, 'block'), 'block');
|
|
166
|
-
const ternary = 'const v = c ? a : {};';
|
|
167
|
-
assert.equal(_jsBraceKindAt(ternary, ternary.indexOf('{}'), null, 'block'), 'object');
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
test('a case-label block keeps the callee behind it', () => {
|
|
171
|
-
const rel = 'probe-case.mjs';
|
|
172
|
-
const text = 'function f(){ switch (v) { case c ? a : b: {} /[}]/.test(x); tail(); } }\n';
|
|
173
|
-
const node = {
|
|
174
|
-
rel,
|
|
175
|
-
abs: rel,
|
|
176
|
-
lang: 'javascript',
|
|
177
|
-
fingerprint: '',
|
|
178
|
-
symbols: [],
|
|
179
|
-
topLevelTypes: [],
|
|
180
|
-
resolvedImports: [],
|
|
181
|
-
rawImports: [],
|
|
182
|
-
};
|
|
183
|
-
const graph = {
|
|
184
|
-
nodes: new Map([[rel, node]]),
|
|
185
|
-
reverse: new Map(),
|
|
186
|
-
_sourceTextCache: new Map([[rel, { fingerprint: '', text }]]),
|
|
187
|
-
_sourceLinesCache: new Map(),
|
|
188
|
-
_maskedLinesCache: new Map(),
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const names = _extractCallees(
|
|
192
|
-
graph,
|
|
193
|
-
{ rel, lang: 'javascript', line: 1, col: 1, declarationLike: true },
|
|
194
|
-
'.',
|
|
195
|
-
{ callerSymbol: 'f' },
|
|
196
|
-
).map((row) => row.name);
|
|
197
|
-
assert.ok(names.includes('tail'), `expected 'tail' in ${JSON.stringify(names)}`);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
test('a labeled block keeps the regex after it and the calls behind it', () => {
|
|
201
|
-
const rel = 'probe-label.mjs';
|
|
202
|
-
const text = 'function f(){ label: {} /[}]/.test(x); inside(); }\n';
|
|
203
|
-
const node = {
|
|
204
|
-
rel,
|
|
205
|
-
abs: rel,
|
|
206
|
-
lang: 'javascript',
|
|
207
|
-
fingerprint: '',
|
|
208
|
-
symbols: [],
|
|
209
|
-
topLevelTypes: [],
|
|
210
|
-
resolvedImports: [],
|
|
211
|
-
rawImports: [],
|
|
212
|
-
};
|
|
213
|
-
const graph = {
|
|
214
|
-
nodes: new Map([[rel, node]]),
|
|
215
|
-
reverse: new Map(),
|
|
216
|
-
_sourceTextCache: new Map([[rel, { fingerprint: '', text }]]),
|
|
217
|
-
_sourceLinesCache: new Map(),
|
|
218
|
-
_maskedLinesCache: new Map(),
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const rows = _extractCallees(
|
|
222
|
-
graph,
|
|
223
|
-
{ rel, lang: 'javascript', line: 1, col: 1, declarationLike: true },
|
|
224
|
-
'.',
|
|
225
|
-
{ callerSymbol: 'f' },
|
|
226
|
-
);
|
|
227
|
-
const names = rows.map((row) => row.name);
|
|
228
|
-
assert.ok(names.includes('test'), `expected 'test' in ${JSON.stringify(names)}`);
|
|
229
|
-
assert.ok(names.includes('inside'), `expected 'inside' in ${JSON.stringify(names)}`);
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
test('a multiline object-literal division does not swallow the rest of the file', () => {
|
|
233
|
-
// Probe: the `/` sits on its own line after `{}`. A line-break heuristic
|
|
234
|
-
// reads it as a regex, runs past the closing brace and attributes the
|
|
235
|
-
// following top-level call as a callee of f.
|
|
236
|
-
const rel = 'probe.mjs';
|
|
237
|
-
const text = 'function f(){ const x = {}\n/ 2; } outside();\n';
|
|
238
|
-
const node = {
|
|
239
|
-
rel,
|
|
240
|
-
abs: rel,
|
|
241
|
-
lang: 'javascript',
|
|
242
|
-
fingerprint: '',
|
|
243
|
-
symbols: [],
|
|
244
|
-
topLevelTypes: [],
|
|
245
|
-
resolvedImports: [],
|
|
246
|
-
rawImports: [],
|
|
247
|
-
};
|
|
248
|
-
const graph = {
|
|
249
|
-
nodes: new Map([[rel, node]]),
|
|
250
|
-
reverse: new Map(),
|
|
251
|
-
_sourceTextCache: new Map([[rel, { fingerprint: '', text }]]),
|
|
252
|
-
_sourceLinesCache: new Map(),
|
|
253
|
-
_maskedLinesCache: new Map(),
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
// The discriminator: a bare line break says "regex", the tracked brace
|
|
257
|
-
// kind says "division". The scanner uses the tracked kind.
|
|
258
|
-
assert.equal(_atJsRegexPosition(text, text.indexOf('/ 2')), true);
|
|
259
|
-
assert.equal(_atJsRegexPosition(text, text.indexOf('/ 2'), 'object'), false);
|
|
260
|
-
|
|
261
|
-
const rows = _extractCallees(
|
|
262
|
-
graph,
|
|
263
|
-
{ rel, lang: 'javascript', line: 1, col: 1, declarationLike: true },
|
|
264
|
-
'.',
|
|
265
|
-
{ callerSymbol: 'f' },
|
|
266
|
-
);
|
|
267
|
-
assert.deepEqual(rows.map((row) => row.name), []);
|
|
268
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import { applyShellEgressPolicy, scrubRuntimeRootVars } from './env-scrub.mjs';
|
|
5
|
-
|
|
6
|
-
test('web-search disabled preserves ordinary shell network environment', () => {
|
|
7
|
-
const previous = process.env.MIXDOG_FEATURE_WEB_SEARCH;
|
|
8
|
-
process.env.MIXDOG_FEATURE_WEB_SEARCH = '0';
|
|
9
|
-
try {
|
|
10
|
-
const env = {
|
|
11
|
-
HTTP_PROXY: 'http://proxy.example:8080',
|
|
12
|
-
HTTPS_PROXY: 'http://proxy.example:8080',
|
|
13
|
-
NO_PROXY: 'localhost',
|
|
14
|
-
};
|
|
15
|
-
assert.equal(applyShellEgressPolicy(env), env);
|
|
16
|
-
assert.deepEqual(env, {
|
|
17
|
-
HTTP_PROXY: 'http://proxy.example:8080',
|
|
18
|
-
HTTPS_PROXY: 'http://proxy.example:8080',
|
|
19
|
-
NO_PROXY: 'localhost',
|
|
20
|
-
});
|
|
21
|
-
} finally {
|
|
22
|
-
if (previous === undefined) delete process.env.MIXDOG_FEATURE_WEB_SEARCH;
|
|
23
|
-
else process.env.MIXDOG_FEATURE_WEB_SEARCH = previous;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('spawned children never inherit the Electron execution-mode switch', () => {
|
|
28
|
-
// ELECTRON_RUN_AS_NODE=1 turns any Electron app the child launches into a
|
|
29
|
-
// bare node interpreter, which swallows a leading `--` as its
|
|
30
|
-
// end-of-options marker and rejects the app's own CLI flags.
|
|
31
|
-
const env = {
|
|
32
|
-
ELECTRON_RUN_AS_NODE: '1',
|
|
33
|
-
PATH: '/usr/bin',
|
|
34
|
-
MIXDOG_DATA_DIR: '/home/u/.mixdog/data',
|
|
35
|
-
};
|
|
36
|
-
scrubRuntimeRootVars(env);
|
|
37
|
-
assert.equal(env.ELECTRON_RUN_AS_NODE, undefined);
|
|
38
|
-
// The child still needs to locate its tools and user data.
|
|
39
|
-
assert.equal(env.PATH, '/usr/bin');
|
|
40
|
-
assert.equal(env.MIXDOG_DATA_DIR, '/home/u/.mixdog/data');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('runtime-root scrub clears host identity and leaves user environment intact', () => {
|
|
44
|
-
const env = {
|
|
45
|
-
MIXDOG_ROOT: '/app/resources/runtime.asar',
|
|
46
|
-
NODE_ENV: 'production',
|
|
47
|
-
MIXDOG_DAEMON_HOST: '1',
|
|
48
|
-
MIXDOG_WORKER_MODE: '1',
|
|
49
|
-
MIXDOG_DAEMON_SPAWNED_FOR: 'session',
|
|
50
|
-
MIXDOG_SUPERVISOR_PID: '4242',
|
|
51
|
-
MIXDOG_SERVER_PID: '74976',
|
|
52
|
-
ELECTRON_RUN_AS_NODE: '1',
|
|
53
|
-
HOME: '/home/u',
|
|
54
|
-
};
|
|
55
|
-
assert.equal(scrubRuntimeRootVars(env), env);
|
|
56
|
-
assert.deepEqual(env, { HOME: '/home/u' });
|
|
57
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
|
|
7
|
-
import { findCachedGraphBinary } from './graph-binary-fetcher.mjs';
|
|
8
|
-
|
|
9
|
-
test('graph cache lookup rejects unmanifested and hash-mismatched executables', () => {
|
|
10
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-graph-cache-'));
|
|
11
|
-
try {
|
|
12
|
-
const dir = join(root, 'graph-bin');
|
|
13
|
-
mkdirSync(dir, { recursive: true });
|
|
14
|
-
writeFileSync(join(dir, process.platform === 'win32' ? 'mixdog-graph-evil.exe' : 'mixdog-graph-evil'), 'evil');
|
|
15
|
-
assert.equal(findCachedGraphBinary(root), null);
|
|
16
|
-
} finally {
|
|
17
|
-
rmSync(root, { recursive: true, force: true });
|
|
18
|
-
}
|
|
19
|
-
});
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { existsSync, mkdtempSync, rmSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join, resolve } from 'node:path';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
import { setTimeout as delay } from 'node:timers/promises';
|
|
7
|
-
|
|
8
|
-
import { execShellCommand } from '../shell-command.mjs';
|
|
9
|
-
import { retireShellJobRecord } from '../builtin/lib/shell-job-records.mjs';
|
|
10
|
-
import {
|
|
11
|
-
_assertNativeSpawnCapabilitiesForTest,
|
|
12
|
-
_resetNativeSpawnClientForTest,
|
|
13
|
-
_setNativeSpawnBinaryForTest,
|
|
14
|
-
cancelNativeTasks,
|
|
15
|
-
listNativeTasks,
|
|
16
|
-
shutdownNativeSpawnServer,
|
|
17
|
-
waitNativeTask,
|
|
18
|
-
} from './native-spawn-client.mjs';
|
|
19
|
-
|
|
20
|
-
test('native spawn rejects binaries without the required lifecycle protocol', () => {
|
|
21
|
-
assert.throws(
|
|
22
|
-
() => _assertNativeSpawnCapabilitiesForTest({
|
|
23
|
-
trackedForeground: true,
|
|
24
|
-
promoteTask: true,
|
|
25
|
-
}),
|
|
26
|
-
(error) => error?.code === 'NATIVE_SPAWN_INCOMPATIBLE'
|
|
27
|
-
&& error.missingCaps?.includes('cancelOwner'),
|
|
28
|
-
);
|
|
29
|
-
assert.equal(_assertNativeSpawnCapabilitiesForTest({
|
|
30
|
-
trackedForeground: true,
|
|
31
|
-
promoteTask: true,
|
|
32
|
-
cancelOwner: true,
|
|
33
|
-
}), true);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('foreground shell has stable owner identity before promotion', { timeout: 15_000 }, async (t) => {
|
|
37
|
-
const binary = resolve(
|
|
38
|
-
'native/mixdog-spawn/target/debug',
|
|
39
|
-
process.platform === 'win32' ? 'mixdog-spawn.exe' : 'mixdog-spawn',
|
|
40
|
-
);
|
|
41
|
-
if (!existsSync(binary)) {
|
|
42
|
-
t.skip(`native spawn test binary not found: ${binary}`);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-native-owner-'));
|
|
46
|
-
const previousDataDir = process.env.MIXDOG_DATA_DIR;
|
|
47
|
-
process.env.MIXDOG_DATA_DIR = root;
|
|
48
|
-
const ownerSessionId = `sess_native_owner_${process.pid}`;
|
|
49
|
-
let jobId = null;
|
|
50
|
-
const admission = {
|
|
51
|
-
async acquire() {
|
|
52
|
-
return {
|
|
53
|
-
signal: null,
|
|
54
|
-
async detachDependency() {},
|
|
55
|
-
async release() {},
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
try {
|
|
60
|
-
_setNativeSpawnBinaryForTest(binary);
|
|
61
|
-
const running = execShellCommand({
|
|
62
|
-
shell: process.execPath,
|
|
63
|
-
shellArg: '',
|
|
64
|
-
command: 'native stable foreground ownership test',
|
|
65
|
-
directArgv: ['-e', 'setTimeout(() => {}, 10000)'],
|
|
66
|
-
env: process.env,
|
|
67
|
-
cwd: process.cwd(),
|
|
68
|
-
timeoutMs: 5_000,
|
|
69
|
-
autoBackgroundMs: 250,
|
|
70
|
-
backgroundOnTimeout: true,
|
|
71
|
-
promotedTimeoutMs: 5_000,
|
|
72
|
-
backgroundDeadlineMs: 5_000,
|
|
73
|
-
ownerSessionId,
|
|
74
|
-
clientHostPid: process.pid,
|
|
75
|
-
admission,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
let foreground = null;
|
|
79
|
-
for (let attempt = 0; attempt < 100; attempt += 1) {
|
|
80
|
-
foreground = listNativeTasks().find((task) =>
|
|
81
|
-
task.status === 'running' && task.ownerSessionId === ownerSessionId);
|
|
82
|
-
if (foreground) break;
|
|
83
|
-
await delay(10);
|
|
84
|
-
}
|
|
85
|
-
assert.ok(foreground, 'foreground process was not owner-tracked at spawn');
|
|
86
|
-
jobId = foreground.jobId;
|
|
87
|
-
|
|
88
|
-
const result = await running;
|
|
89
|
-
assert.equal(result.backgrounded, true);
|
|
90
|
-
assert.equal(result.jobId, jobId);
|
|
91
|
-
|
|
92
|
-
assert.ok(cancelNativeTasks({ ownerSessionId }).cancelled >= 1);
|
|
93
|
-
const terminal = await waitNativeTask(jobId, 3_000);
|
|
94
|
-
assert.notEqual(terminal?.status, 'running');
|
|
95
|
-
assert.equal(terminal?.status, 'cancelled');
|
|
96
|
-
} finally {
|
|
97
|
-
if (jobId) retireShellJobRecord(jobId);
|
|
98
|
-
await shutdownNativeSpawnServer('test-finish').catch(() => {});
|
|
99
|
-
_resetNativeSpawnClientForTest();
|
|
100
|
-
if (previousDataDir === undefined) delete process.env.MIXDOG_DATA_DIR;
|
|
101
|
-
else process.env.MIXDOG_DATA_DIR = previousDataDir;
|
|
102
|
-
rmSync(root, { recursive: true, force: true });
|
|
103
|
-
}
|
|
104
|
-
});
|