@danceiny/gotry 0.0.1-rc.21 → 0.0.1-rc.24
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/README.md +102 -194
- package/README.zh-CN.md +115 -210
- package/bin/gotry-backend.js +53 -0
- package/bin/gotry-bootstrap.js +466 -35
- package/bin/gotry-inner.js +255 -36
- package/bin/gotry-process-liveness.d.ts +27 -0
- package/bin/gotry-process-liveness.js +97 -0
- package/bin/gotry-runtime-resolution.d.ts +1 -1
- package/bin/gotry-runtime-resolution.js +2 -2
- package/client/client.js +174 -0
- package/cordis.gotry-patch.yml +70 -93
- package/dist/capabilities/agent-reach-deep.js +45 -122
- package/dist/capabilities/agent-reach.js +63 -148
- package/dist/capabilities/anything.js +89 -75
- package/dist/capabilities/artifacts.js +123 -104
- package/dist/capabilities/channel-health.js +65 -45
- package/dist/capabilities/channel-registry.js +108 -87
- package/dist/capabilities/doctor.js +357 -235
- package/dist/capabilities/effect.js +223 -309
- package/dist/capabilities/fact-log.js +28 -14
- package/dist/capabilities/flyai.js +245 -156
- package/dist/capabilities/ground-transfer.js +509 -0
- package/dist/capabilities/hbcli.js +144 -148
- package/dist/capabilities/hotelbyte-transaction.js +194 -0
- package/dist/capabilities/incident-log.js +131 -61
- package/dist/capabilities/model-override.js +30 -10
- package/dist/capabilities/opensky.js +54 -43
- package/dist/capabilities/resilience.js +50 -32
- package/dist/capabilities/session/action-cache.js +50 -44
- package/dist/capabilities/session/adapters/ctrip-flight.js +119 -62
- package/dist/capabilities/session/adapters/ctrip-hotel.js +125 -110
- package/dist/capabilities/session/adapters/dida-portal.js +206 -0
- package/dist/capabilities/session/adapters/meituan-local.js +35 -54
- package/dist/capabilities/session/adapters/rail-12306.js +169 -112
- package/dist/capabilities/session/benchmark.js +85 -149
- package/dist/capabilities/session/extension-bridge.js +320 -259
- package/dist/capabilities/session/extension-channel.js +57 -76
- package/dist/capabilities/session/extension-distribution.js +115 -119
- package/dist/capabilities/session/extract.js +31 -21
- package/dist/capabilities/session/golden-score.js +55 -33
- package/dist/capabilities/session/health-watch.js +146 -154
- package/dist/capabilities/session/read-guard.js +55 -47
- package/dist/capabilities/session/static-flight-golden.js +49 -36
- package/dist/capabilities/session/transport.js +54 -61
- package/dist/capabilities/session/wizard.js +63 -93
- package/dist/capabilities/session-consent.js +143 -47
- package/dist/capabilities/session-login.js +95 -126
- package/dist/capabilities/session-search.js +391 -253
- package/dist/capabilities/sponsor-plugin.js +341 -0
- package/dist/capabilities/visa-policy.js +87 -73
- package/dist/capabilities/weather.js +163 -235
- package/dist/scripts/action-cache-tests.js +24 -59
- package/dist/scripts/agent-planning-turn-deadline-e2e.js +91 -142
- package/dist/scripts/agent-planning-turn-deadline-tests.js +80 -176
- package/dist/scripts/agent-reach-deep-tests.js +30 -40
- package/dist/scripts/agent-reach-tests.js +26 -18
- package/dist/scripts/agent-reach-wrapper-tests.js +46 -50
- package/dist/scripts/anything-tests.js +58 -62
- package/dist/scripts/artifact-client-contract-tests.js +69 -0
- package/dist/scripts/artifacts-capability-tests.js +235 -0
- package/dist/scripts/async-collect.js +26 -15
- package/dist/scripts/benchmark-environment-bridge-e2e.js +287 -684
- package/dist/scripts/benchmark-environment-bridge-tests.js +818 -3123
- package/dist/scripts/booking-copilot-availability-ledger-binding-tests.js +66 -279
- package/dist/scripts/booking-copilot-availability-policy-tests.js +153 -1257
- package/dist/scripts/booking-copilot-bin-proof-tests.js +22 -45
- package/dist/scripts/booking-copilot-crossrepo-fixture-server.js +64 -76
- package/dist/scripts/booking-copilot-dsh-core-proof-tests.js +69 -199
- package/dist/scripts/booking-copilot-dsh-planner-proof-tests.js +393 -759
- package/dist/scripts/booking-copilot-dsh-plugin-proof-tests.js +33 -75
- package/dist/scripts/booking-copilot-event-sequence-concurrency-proof-tests.js +60 -110
- package/dist/scripts/booking-copilot-gap-code-contract-proof-tests.js +28 -66
- package/dist/scripts/booking-copilot-operation-ledger-concurrency-proof-tests.js +72 -271
- package/dist/scripts/booking-copilot-receipt-ledger-concurrency-proof-tests.js +73 -275
- package/dist/scripts/booking-copilot-runtime-proof-tests.js +784 -3398
- package/dist/scripts/booking-copilot-server-proof-tests.js +63 -168
- package/dist/scripts/booking-copilot-startup-proof-tests.js +38 -124
- package/dist/scripts/booking-executor-tests.js +80 -0
- package/dist/scripts/booking-recovery-chain-tests.js +182 -0
- package/dist/scripts/booking-saga-tests.js +61 -123
- package/dist/scripts/booking-surface-contract-proof-tests.js +152 -1167
- package/dist/scripts/bootstrap-tests.js +1383 -128
- package/dist/scripts/build-changelog.js +89 -130
- package/dist/scripts/build-metrics-report.js +135 -143
- package/dist/scripts/changelog-tests.js +35 -82
- package/dist/scripts/channel-probe-tests.js +44 -116
- package/dist/scripts/channel-probe.js +84 -167
- package/dist/scripts/channel-registry-tests.js +97 -185
- package/dist/scripts/companion-tests.js +25 -70
- package/dist/scripts/dida-cookie-probe.js +87 -0
- package/dist/scripts/dida-sw-probe.js +114 -0
- package/dist/scripts/diff-test.js +17 -12
- package/dist/scripts/doctor-tests.js +428 -120
- package/dist/scripts/dsh-artifact-e2e.js +150 -0
- package/dist/scripts/dsh-artifact-web-e2e.js +443 -0
- package/dist/scripts/dsh-http-proxy-sse-proof.js +90 -0
- package/dist/scripts/dsh-runtime-closure-tests.js +110 -153
- package/dist/scripts/dsh-runtime-closure.js +75 -63
- package/dist/scripts/dsh-session-v3-migration-proof.js +106 -0
- package/dist/scripts/dsh-subprocess-local-proof.js +149 -0
- package/dist/scripts/dsh-target-closure-proof.js +178 -0
- package/dist/scripts/effect-tests.js +165 -552
- package/dist/scripts/engine-run.js +1 -3
- package/dist/scripts/engine-tests.js +16 -10
- package/dist/scripts/evaluation-cadence-tests.js +69 -242
- package/dist/scripts/evaluation-contract-tests.js +193 -499
- package/dist/scripts/extension-distribution-cli.js +19 -15
- package/dist/scripts/extension-distribution-tests.js +98 -211
- package/dist/scripts/extension-tests.js +366 -389
- package/dist/scripts/fact-gate-tests.js +725 -263
- package/dist/scripts/fixtures/extension-bridge-unref-child.mjs +21 -0
- package/dist/scripts/flight-hotel-anchor-363-registered-e2e.js +169 -0
- package/dist/scripts/flight-malformed-tests.js +159 -0
- package/dist/scripts/flyai-tests.js +325 -68
- package/dist/scripts/g5-guard-tests.js +131 -0
- package/dist/scripts/g5-guard.js +189 -0
- package/dist/scripts/gen-lunar-anchors.js +106 -0
- package/dist/scripts/gotry-backend-kernel-tests.js +79 -0
- package/dist/scripts/ground-transfer-tests.js +956 -0
- package/dist/scripts/hbcli-e2e-tests.js +71 -90
- package/dist/scripts/hbcli-live-optin-tests.js +96 -0
- package/dist/scripts/hbcli-release-contract-tests.js +122 -0
- package/dist/scripts/hbcli-tests.js +41 -115
- package/dist/scripts/health-watch-cli.js +42 -28
- package/dist/scripts/hotel-date-gate-tests.js +496 -0
- package/dist/scripts/hotelbyte-reconcile-tests.js +141 -0
- package/dist/scripts/hotelbyte-spawn-e2e-tests.js +373 -0
- package/dist/scripts/i18n-tests.js +16 -9
- package/dist/scripts/incident-tests.js +281 -87
- package/dist/scripts/issue-194-job-id-guard-tests.js +106 -0
- package/dist/scripts/issue-233-cancel-refund-commission-tests.js +392 -0
- package/dist/scripts/issue-271-liveness-tests.js +547 -0
- package/dist/scripts/issue-289-model-retry-real-tests.js +296 -0
- package/dist/scripts/issue-289-model-retry-tests.js +441 -0
- package/dist/scripts/issue-289-web-retry-e2e.js +630 -0
- package/dist/scripts/issue-338-home-city-e2e.js +577 -0
- package/dist/scripts/issue343-real-entry-e2e.js +160 -0
- package/dist/scripts/journey-tests.js +22 -27
- package/dist/scripts/kernel-manifest-evidence.js +109 -0
- package/dist/scripts/kernel-manifest-gate.js +126 -0
- package/dist/scripts/kernel-manifest-tests.js +212 -0
- package/dist/scripts/kernel-manifest-trace-entry.js +7 -0
- package/dist/scripts/kernel-manifest-trace-hook.mjs +28 -0
- package/dist/scripts/kernel-manifest.js +369 -0
- package/dist/scripts/ledger-repair-apply-tests.js +316 -0
- package/dist/scripts/ledger-repair-plan-tests.js +375 -0
- package/dist/scripts/ledger-tests.js +325 -340
- package/dist/scripts/ledger-workflow-crash.js +10 -20
- package/dist/scripts/map-tools-vendor-package-proof.js +206 -134
- package/dist/scripts/memory-capture-tests.js +242 -61
- package/dist/scripts/memory-decay-tests.js +18 -52
- package/dist/scripts/memory-lifecycle-tests.js +657 -0
- package/dist/scripts/memory-lifecycle.js +196 -0
- package/dist/scripts/memory-metrics.js +24 -12
- package/dist/scripts/memory-value-report.js +474 -222
- package/dist/scripts/memory-value-tests.js +328 -0
- package/dist/scripts/metrics-report-tests.js +62 -199
- package/dist/scripts/model-override-e2e.js +66 -105
- package/dist/scripts/nightly-evidence-tests.js +64 -89
- package/dist/scripts/nightly-evidence.js +108 -111
- package/dist/scripts/nudge-digest.js +39 -28
- package/dist/scripts/onboarding-tests.js +63 -88
- package/dist/scripts/opensky-check.js +18 -13
- package/dist/scripts/opensky-tests.js +28 -28
- package/dist/scripts/persona-surface-guard-tests.js +37 -12
- package/dist/scripts/pnpm-dsh-closure-proof.js +2 -5
- package/dist/scripts/policy-anchor-359-registered-e2e.js +214 -0
- package/dist/scripts/price-drift-tests.js +126 -227
- package/dist/scripts/price-drift-watch.js +209 -253
- package/dist/scripts/probe-poi-tests.js +52 -45
- package/dist/scripts/product-metrics.js +187 -273
- package/dist/scripts/publish-preverify.js +47 -41
- package/dist/scripts/realtime-pricing-tests.js +37 -76
- package/dist/scripts/replay-async.js +20 -18
- package/dist/scripts/replay-real.js +16 -18
- package/dist/scripts/replay.js +52 -82
- package/dist/scripts/session-attach-diagnose.js +16 -12
- package/dist/scripts/session-attach-poc.js +34 -37
- package/dist/scripts/session-benchmark.js +66 -147
- package/dist/scripts/session-dida-live-e2e.js +151 -0
- package/dist/scripts/session-extract-tests.js +14 -35
- package/dist/scripts/session-login.js +14 -13
- package/dist/scripts/session-tests.js +545 -583
- package/dist/scripts/sf-live-benchmark.js +92 -110
- package/dist/scripts/sf-live-cli-tests.js +2 -9
- package/dist/scripts/sf-soft-score-tests.js +19 -60
- package/dist/scripts/sf-summary-tests.js +149 -0
- package/dist/scripts/sf-summary.js +466 -84
- package/dist/scripts/skeleton-check.js +16 -14
- package/dist/scripts/skeleton-integration-test.js +11 -10
- package/dist/scripts/skills-contract-tests.js +51 -46
- package/dist/scripts/smoke-session-gate-tests.js +12 -20
- package/dist/scripts/smoke.js +541 -422
- package/dist/scripts/sponsor-reuse-tests.js +262 -0
- package/dist/scripts/state-cli-tests.js +226 -101
- package/dist/scripts/state-cli.js +549 -212
- package/dist/scripts/static-golden-tests.js +46 -180
- package/dist/scripts/time-eval-tests.js +210 -192
- package/dist/scripts/travel-timeline-tests.js +29 -93
- package/dist/scripts/turn-handoff-collect-tests.js +46 -93
- package/dist/scripts/turn-handoff-collect.js +71 -99
- package/dist/scripts/turn-policy-tests.js +28 -29
- package/dist/scripts/typed-contract-canary.js +77 -162
- package/dist/scripts/tz-resolver-sanity.js +50 -0
- package/dist/scripts/tz-resolver-tests.js +584 -0
- package/dist/scripts/unified-tests.js +23 -19
- package/dist/scripts/visa-policy-tests.js +31 -44
- package/dist/scripts/weather-tests.js +121 -543
- package/dist/scripts/wish-channel-gate-tests.js +29 -86
- package/dist/scripts/write-gate-tests.js +522 -0
- package/dist/scripts/z3-lifecycle-fault-tests.js +188 -0
- package/dist/scripts/z3-lifecycle-tests.js +170 -0
- package/dist/scripts/z3-race-repeat-tests.js +39 -0
- package/dist/scripts/z3-race-tests.js +18 -12
- package/dist/src/artifact-gate.js +652 -221
- package/dist/src/backend/kernel.js +91 -0
- package/dist/src/backend/modules/booking-copilot.js +55 -0
- package/dist/src/backend/modules/booking-executor.js +124 -0
- package/dist/src/backend/modules/session-search.js +194 -0
- package/dist/src/benchmark-agent-conformance.js +296 -262
- package/dist/src/benchmark-environment-bridge.js +298 -413
- package/dist/src/benchmark-headless-child-diagnostics.js +93 -100
- package/dist/src/benchmark-tool-isolation.js +94 -67
- package/dist/src/bookable-facts.js +299 -174
- package/dist/src/booking-saga.js +64 -120
- package/dist/src/booking-surface/availability-policy.js +443 -576
- package/dist/src/booking-surface/cancel-refund-commission.js +379 -0
- package/dist/src/booking-surface/contracts.js +24 -80
- package/dist/src/booking-surface/dsh-planner.js +510 -281
- package/dist/src/booking-surface/dsh-plugin.js +17 -1
- package/dist/src/booking-surface/error-codes.js +82 -10
- package/dist/src/booking-surface/index.js +0 -3
- package/dist/src/booking-surface/profile.js +10 -54
- package/dist/src/booking-surface/recovery-chain.js +367 -0
- package/dist/src/booking-surface/runtime.js +765 -891
- package/dist/src/booking-surface/server.js +200 -251
- package/dist/src/booking-surface/startup.js +58 -54
- package/dist/src/booking-surface/validation.js +150 -218
- package/dist/src/bridge.js +20 -13
- package/dist/src/companions.js +48 -74
- package/dist/src/contracts.js +21 -43
- package/dist/src/dsh-llm.js +82 -120
- package/dist/src/engine.js +253 -239
- package/dist/src/evaluation-cadence.js +72 -209
- package/dist/src/evaluation-contracts.js +220 -843
- package/dist/src/flight-pack-adapter.js +54 -0
- package/dist/src/flight-pack-contract.js +2 -0
- package/dist/src/gotry-backend.js +70 -0
- package/dist/src/hotel-date-gate.js +118 -0
- package/dist/src/i18n.js +18 -7
- package/dist/src/index.js +1425 -1629
- package/dist/src/journey.js +132 -81
- package/dist/src/ledger-repair-apply.js +538 -0
- package/dist/src/ledger-repair-plan.js +463 -0
- package/dist/src/loop.js +257 -166
- package/dist/src/memory-capture.js +180 -32
- package/dist/src/memory-decay.js +30 -14
- package/dist/src/memory-lifecycle.js +1310 -0
- package/dist/src/memory-utility.js +27 -40
- package/dist/src/mock-llm.js +36 -61
- package/dist/src/model.js +81 -36
- package/dist/src/realtime-pricing.js +63 -72
- package/dist/src/slot-spec.js +84 -106
- package/dist/src/state-ledger.js +310 -471
- package/dist/src/subagent-job-id-guard.js +58 -0
- package/dist/src/time-anchor.js +231 -33
- package/dist/src/tool-packet.js +20 -8
- package/dist/src/travel-slots.js +58 -35
- package/dist/src/travel-timeline.js +44 -63
- package/dist/src/turn-deadline.js +121 -127
- package/dist/src/turn-policy.js +61 -89
- package/dist/src/tz-resolver.js +143 -0
- package/dist/src/unified.js +504 -381
- package/dist/src/wish-pool.js +39 -14
- package/dist/src/write-gate.js +495 -0
- package/dist/src/z3-shared.js +273 -7
- package/extension/README.md +4 -3
- package/extension/background.js +125 -14
- package/extension/content-bridge.js +23 -1
- package/extension/content-main.js +15 -4
- package/extension/manifest.json +16 -8
- package/package.json +251 -220
- package/ts/capabilities/agent-reach.ts +4 -4
- package/ts/capabilities/anything.ts +1 -1
- package/ts/capabilities/artifacts.ts +46 -9
- package/ts/capabilities/flyai.ts +156 -37
- package/ts/capabilities/hbcli.ts +1 -1
- package/ts/capabilities/incident-log.ts +88 -59
- package/ts/capabilities/session/adapters/ctrip-flight.ts +99 -36
- package/ts/capabilities/session/adapters/dida-portal.ts +250 -0
- package/ts/capabilities/session/adapters/rail-12306.ts +123 -24
- package/ts/capabilities/session/extension-bridge.ts +226 -101
- package/ts/capabilities/session/extension-channel.ts +22 -9
- package/ts/capabilities/session/wizard.ts +2 -2
- package/ts/capabilities/session-consent.ts +98 -14
- package/ts/capabilities/session-login.ts +1 -0
- package/ts/capabilities/session-search.ts +315 -31
- package/ts/dsh-runtime/vendor/README.md +8 -4
- package/ts/dsh-runtime/vendor/dsh-map-tools/README.en.md +7 -1
- package/ts/dsh-runtime/vendor/dsh-map-tools/README.md +5 -3
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/settings-ns.js +1 -1
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/settings-ns.d.ts +1 -1
- package/ts/dsh-runtime/vendor/dsh-map-tools/package.json +6 -6
- package/ts/package.json +236 -16
- package/ts/scripts/map-tools-vendor-package-proof.ts +152 -31
- package/ts/scripts/state-cli.ts +418 -51
- package/ts/src/artifact-gate.ts +561 -15
- package/ts/src/benchmark-environment-bridge.ts +37 -20
- package/ts/src/bookable-facts.ts +183 -7
- package/ts/src/booking-surface/cancel-refund-commission.ts +488 -0
- package/ts/src/booking-surface/dsh-planner.ts +240 -32
- package/ts/src/booking-surface/dsh-plugin.js +17 -1
- package/ts/src/booking-surface/error-codes.ts +75 -0
- package/ts/src/booking-surface/recovery-chain.ts +409 -0
- package/ts/src/booking-surface/server.ts +84 -51
- package/ts/src/booking-surface/validation.ts +2 -0
- package/ts/src/contracts.ts +12 -2
- package/ts/src/dsh-llm.ts +4 -8
- package/ts/src/index.ts +609 -90
- package/ts/src/loop.ts +116 -7
- package/ts/src/memory-capture.ts +227 -3
- package/ts/src/mock-llm.ts +4 -8
- package/ts/src/model.ts +88 -2
- package/ts/src/state-ledger.ts +47 -29
- package/ts/src/subagent-job-id-guard.ts +72 -0
- package/ts/src/time-anchor.ts +217 -13
- package/ts/src/unified.ts +316 -54
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 崩溃注入探针(ledger-tests 的子进程):创建 durable 工单 → 求解(step done 落账)
|
|
3
|
+
* → 在 settle 之前 kill 自身(exit 9)——模拟「一小时后」回收进程中途崩溃。
|
|
4
|
+
* 用法:npx tsx scripts/ledger-workflow-crash.ts <stateRoot> <ticketId> <countFile>
|
|
5
|
+
*/
|
|
1
6
|
import { appendFileSync } from 'node:fs';
|
|
2
7
|
import { collectDeepPlanning, makeJournaledSolvePort, persistAsyncTicket } from '../src/loop.js';
|
|
3
8
|
import { openLedgerIfExists } from '../src/state-ledger.js';
|
|
@@ -10,33 +15,18 @@ const ticket = {
|
|
|
10
15
|
id,
|
|
11
16
|
objective: '崩溃注入:已求解未交付(settle 前被杀)',
|
|
12
17
|
requestedAt: new Date().toISOString(),
|
|
13
|
-
etaLabel: '秒级'
|
|
18
|
+
etaLabel: '秒级',
|
|
14
19
|
};
|
|
15
20
|
const state = {
|
|
16
|
-
calendar: {
|
|
17
|
-
year: 2026,
|
|
18
|
-
assertedWeekdays: {}
|
|
19
|
-
},
|
|
21
|
+
calendar: { year: 2026, assertedWeekdays: {} },
|
|
20
22
|
profile: {},
|
|
21
23
|
gates: [],
|
|
22
24
|
wishes: [],
|
|
23
|
-
spec: {
|
|
24
|
-
segments: []
|
|
25
|
-
}
|
|
25
|
+
spec: { segments: [] },
|
|
26
26
|
};
|
|
27
27
|
await persistAsyncTicket(ticket, state, root);
|
|
28
28
|
const ledger = openLedgerIfExists(root);
|
|
29
|
-
const solve = makeJournaledSolvePort(ledger, id, async ()=>({
|
|
30
|
-
feasible: false,
|
|
31
|
-
unsat_core: [
|
|
32
|
-
'crash-probe'
|
|
33
|
-
],
|
|
34
|
-
suggestions: []
|
|
35
|
-
}), {
|
|
36
|
-
onRealSolve: ()=>appendFileSync(countFile, 'solve\n')
|
|
37
|
-
});
|
|
29
|
+
const solve = makeJournaledSolvePort(ledger, id, async () => ({ feasible: false, unsat_core: ['crash-probe'], suggestions: [] }), { onRealSolve: () => appendFileSync(countFile, 'solve\n') });
|
|
38
30
|
await collectDeepPlanning(state, ticket, solve);
|
|
31
|
+
// solve 步骤已 done 落账,交付未落——此刻崩掉
|
|
39
32
|
process.exit(9);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//# sourceURL=ts/scripts/ledger-workflow-crash.ts
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package proof for issue #202.
|
|
3
|
+
*
|
|
4
|
+
* The full suite passes the executable from its clean tarball install; focused
|
|
5
|
+
* runs pack/unpack locally and attach the already-installed root closure. Both
|
|
6
|
+
* paths load the plugin from the artifact, never from the checkout vendor path.
|
|
7
|
+
* No map provider or paid endpoint is contacted; inline-coordinate geocoding is
|
|
8
|
+
* asserted with fetch disabled.
|
|
9
|
+
*/
|
|
1
10
|
import { execFileSync } from 'node:child_process';
|
|
2
11
|
import { createHash } from 'node:crypto';
|
|
3
|
-
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, symlinkSync } from 'node:fs';
|
|
12
|
+
import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
4
13
|
import { createRequire } from 'node:module';
|
|
5
14
|
import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
|
|
15
|
+
import { tmpdir } from 'node:os';
|
|
6
16
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
17
|
import assert from 'node:assert/strict';
|
|
8
18
|
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
|
|
9
19
|
const upstreamLicenseSha256 = 'b6bbb0c73a02cf8d2c304e9f208b41c32f0a810fabe366986e2b14ac3338f618';
|
|
10
20
|
const upstreamVendorFileCount = 32;
|
|
11
|
-
const
|
|
21
|
+
const adaptedVendorAggregateSha256 = '65ac7b76a62c07bda771c476fff6b4c5e4220b013ce74ad3c54e6b95e5b34063';
|
|
12
22
|
const expectedTools = [
|
|
13
23
|
'map_bicycling_route',
|
|
14
24
|
'map_driving_route',
|
|
@@ -16,72 +26,112 @@ const expectedTools = [
|
|
|
16
26
|
'map_poi_search',
|
|
17
27
|
'map_reverse_geocode',
|
|
18
28
|
'map_transit_route',
|
|
19
|
-
'map_walking_route'
|
|
29
|
+
'map_walking_route',
|
|
20
30
|
];
|
|
21
31
|
function sha256(path) {
|
|
22
32
|
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
23
33
|
}
|
|
24
34
|
function vendorAggregate(root) {
|
|
25
35
|
const files = [];
|
|
26
|
-
const walk = (directory)=>{
|
|
27
|
-
for (const entry of readdirSync(directory, {
|
|
28
|
-
withFileTypes: true
|
|
29
|
-
})){
|
|
36
|
+
const walk = (directory) => {
|
|
37
|
+
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
30
38
|
const path = join(directory, entry.name);
|
|
31
|
-
if (entry.isDirectory())
|
|
32
|
-
|
|
39
|
+
if (entry.isDirectory())
|
|
40
|
+
walk(path);
|
|
41
|
+
else
|
|
42
|
+
files.push(path.slice(root.length + 1).replaceAll('\\', '/'));
|
|
33
43
|
}
|
|
34
44
|
};
|
|
35
45
|
walk(root);
|
|
36
46
|
files.sort();
|
|
37
47
|
const digest = createHash('sha256');
|
|
38
|
-
for (const relative of files){
|
|
48
|
+
for (const relative of files) {
|
|
39
49
|
digest.update(relative);
|
|
40
50
|
digest.update('\0');
|
|
41
51
|
digest.update(readFileSync(join(root, relative)));
|
|
42
52
|
digest.update('\0');
|
|
43
53
|
}
|
|
44
|
-
return {
|
|
45
|
-
count: files.length,
|
|
46
|
-
sha256: digest.digest('hex')
|
|
47
|
-
};
|
|
54
|
+
return { count: files.length, sha256: digest.digest('hex') };
|
|
48
55
|
}
|
|
49
|
-
function
|
|
56
|
+
function assertPackagingExcludesNodeModules() {
|
|
57
|
+
const tempRoot = mkdtempSync(join(tmpdir(), 'gotry-pack-excl-'));
|
|
58
|
+
try {
|
|
59
|
+
const archiveTar = join(tempRoot, 'head.tar');
|
|
60
|
+
execFileSync('git', ['archive', '--format=tar', '--output', archiveTar, 'HEAD'], { cwd: repoRoot });
|
|
61
|
+
const checkoutDir = join(tempRoot, 'checkout');
|
|
62
|
+
mkdirSync(checkoutDir);
|
|
63
|
+
execFileSync('tar', ['-xf', archiveTar, '-C', checkoutDir]);
|
|
64
|
+
copyFileSync(join(repoRoot, 'package.json'), join(checkoutDir, 'package.json'));
|
|
65
|
+
const vendorBinDir = join(checkoutDir, 'ts/dsh-runtime/vendor/dsh-map-tools/node_modules/.bin');
|
|
66
|
+
mkdirSync(vendorBinDir, { recursive: true });
|
|
67
|
+
for (const name of ['cordis', 'tsc', 'tsserver', 'vitest']) {
|
|
68
|
+
const binPath = join(vendorBinDir, name);
|
|
69
|
+
writeFileSync(binPath, '#!/usr/bin/env node\n');
|
|
70
|
+
chmodSync(binPath, 0o755);
|
|
71
|
+
}
|
|
72
|
+
const packDir = join(tempRoot, 'pack');
|
|
73
|
+
mkdirSync(packDir);
|
|
74
|
+
const packOutput = execFileSync('npm', [
|
|
75
|
+
'pack', '--ignore-scripts', '--json', '--pack-destination', packDir,
|
|
76
|
+
], { cwd: checkoutDir, encoding: 'utf8' });
|
|
77
|
+
const packInfo = JSON.parse(packOutput);
|
|
78
|
+
assert.equal(packInfo.length, 1, 'temp npm pack must produce one artifact');
|
|
79
|
+
const tarball = join(packDir, packInfo[0].filename);
|
|
80
|
+
assert.ok(existsSync(tarball), `temp packed artifact missing: ${tarball}`);
|
|
81
|
+
const entries = execFileSync('tar', ['-tzf', tarball], { encoding: 'utf8' }).trimEnd().split('\n');
|
|
82
|
+
const nodeModulesEntries = entries.filter(path => path.startsWith('package/ts/dsh-runtime/vendor/dsh-map-tools/node_modules'));
|
|
83
|
+
assert.equal(nodeModulesEntries.length, 0, `npm pack must exclude vendor node_modules: found ${nodeModulesEntries.join(', ')}`);
|
|
84
|
+
const extractDir = join(tempRoot, 'extracted');
|
|
85
|
+
mkdirSync(extractDir);
|
|
86
|
+
execFileSync('tar', ['-xzf', tarball, '-C', extractDir]);
|
|
87
|
+
const packedVendorRoot = join(extractDir, 'package/ts/dsh-runtime/vendor/dsh-map-tools');
|
|
88
|
+
const packedAggregate = vendorAggregate(packedVendorRoot);
|
|
89
|
+
assert.equal(packedAggregate.count, upstreamVendorFileCount, 'packed vendor file count drifted');
|
|
90
|
+
assert.equal(packedAggregate.sha256, adaptedVendorAggregateSha256, 'packed vendor aggregate drifted');
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
rmSync(tempRoot, { recursive: true, force: true });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function assertTargetLockClosure() {
|
|
50
97
|
const manifest = JSON.parse(readFileSync(join(repoRoot, 'ts/package.json'), 'utf8'));
|
|
51
98
|
assert.equal(manifest.dependencies?.['dsh-map-tools'], undefined, 'external map-tools dependency must stay removed');
|
|
52
99
|
const lock = JSON.parse(readFileSync(join(repoRoot, 'ts/package-lock.json'), 'utf8'));
|
|
53
100
|
assert.equal(lock.packages?.['']?.dependencies?.['dsh-map-tools'], undefined, 'lock root must not resolve external map-tools');
|
|
54
101
|
assert.equal(lock.packages?.['node_modules/dsh-map-tools'], undefined, 'lock must not carry external map-tools');
|
|
55
|
-
const dshEntries = Object.entries(lock.packages ?? {}).filter(([path])
|
|
102
|
+
const dshEntries = Object.entries(lock.packages ?? {}).filter(([path]) => /(?:^|\/)node_modules\/@deepseek-ai\/(?:dsh|dsh-[^/]+)$/.test(path));
|
|
56
103
|
assert.ok(dshEntries.length >= 10, 'expected dsh-tools peer closure in the ts lock');
|
|
57
|
-
for (const [path, entry] of dshEntries){
|
|
58
|
-
assert.equal(entry.version, '0.1.
|
|
104
|
+
for (const [path, entry] of dshEntries) {
|
|
105
|
+
assert.equal(entry.version, '0.1.5-rc.1', `${path} drifted outside the 0.1.5-rc.1 closure`);
|
|
59
106
|
}
|
|
60
|
-
return {
|
|
61
|
-
packages: dshEntries.length,
|
|
62
|
-
version: '0.1.2-alpha.3'
|
|
63
|
-
};
|
|
107
|
+
return { packages: dshEntries.length, version: '0.1.5-rc.1' };
|
|
64
108
|
}
|
|
65
109
|
function findPackageRoot(entry) {
|
|
66
110
|
let cursor = dirname(entry);
|
|
67
|
-
for(;;){
|
|
111
|
+
for (;;) {
|
|
68
112
|
const manifestPath = join(cursor, 'package.json');
|
|
69
113
|
if (existsSync(manifestPath)) {
|
|
70
114
|
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
71
|
-
if (manifest.name === '@danceiny/gotry')
|
|
115
|
+
if (manifest.name === '@danceiny/gotry')
|
|
116
|
+
return cursor;
|
|
72
117
|
}
|
|
73
118
|
const parent = dirname(cursor);
|
|
74
|
-
if (parent === cursor)
|
|
119
|
+
if (parent === cursor)
|
|
120
|
+
throw new Error(`cannot locate @danceiny/gotry package root from ${entry}`);
|
|
75
121
|
cursor = parent;
|
|
76
122
|
}
|
|
77
123
|
}
|
|
78
124
|
function assertBinTargetsPackage(binPath, expectedTarget) {
|
|
79
125
|
const resolvedExpectedTarget = realpathSync(expectedTarget);
|
|
80
|
-
if (realpathSync(binPath) === resolvedExpectedTarget)
|
|
126
|
+
if (realpathSync(binPath) === resolvedExpectedTarget)
|
|
127
|
+
return;
|
|
128
|
+
// pnpm writes an executable shell shim instead of a symlink. Its final
|
|
129
|
+
// machine-readable marker is safer to verify than accepting any occurrence
|
|
130
|
+
// of the package path in an otherwise unrelated executable.
|
|
81
131
|
const shim = readFileSync(binPath, 'utf8');
|
|
82
132
|
assert.ok(Buffer.byteLength(shim, 'utf8') <= 32_768, 'clean-install gotry shim is unexpectedly large');
|
|
83
133
|
const lines = shim.trimEnd().split(/\r?\n/);
|
|
84
|
-
const markers = lines.filter(
|
|
134
|
+
const markers = lines.filter(line => line.startsWith('# cmd-shim-target='));
|
|
85
135
|
assert.equal(markers.length, 1, 'pnpm gotry shim must contain exactly one target marker');
|
|
86
136
|
assert.equal(lines.at(-1), markers[0], 'pnpm gotry shim target marker must be the final line');
|
|
87
137
|
const markerTarget = markers[0].slice('# cmd-shim-target='.length);
|
|
@@ -99,55 +149,39 @@ function prepareProofPackage(cleanInstalledBin) {
|
|
|
99
149
|
const packageRoot = findPackageRoot(packageMain);
|
|
100
150
|
const installedManifest = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));
|
|
101
151
|
assert.equal(installedManifest.name, '@danceiny/gotry', 'clean-install executable must belong to GoTry');
|
|
102
|
-
const declaredBin = typeof installedManifest.bin === 'string'
|
|
152
|
+
const declaredBin = typeof installedManifest.bin === 'string'
|
|
153
|
+
? installedManifest.bin
|
|
154
|
+
: installedManifest.bin?.gotry;
|
|
103
155
|
assert.equal(declaredBin, 'bin/gotry-inner.js', 'installed package must declare the production gotry bin');
|
|
104
156
|
assertBinTargetsPackage(binPath, join(packageRoot, declaredBin));
|
|
105
|
-
return {
|
|
106
|
-
packageRoot
|
|
107
|
-
};
|
|
157
|
+
return { packageRoot };
|
|
108
158
|
}
|
|
109
159
|
const proofRoot = mkdtempSync(join(repoRoot, '.tmp-map-tools-proof-'));
|
|
110
160
|
try {
|
|
111
161
|
const packOutput = execFileSync('npm', [
|
|
112
|
-
'pack',
|
|
113
|
-
|
|
114
|
-
'--json',
|
|
115
|
-
'--pack-destination',
|
|
116
|
-
proofRoot
|
|
117
|
-
], {
|
|
118
|
-
cwd: repoRoot,
|
|
119
|
-
encoding: 'utf8'
|
|
120
|
-
});
|
|
162
|
+
'pack', '--ignore-scripts', '--json', '--pack-destination', proofRoot,
|
|
163
|
+
], { cwd: repoRoot, encoding: 'utf8' });
|
|
121
164
|
const packInfo = JSON.parse(packOutput);
|
|
122
165
|
assert.equal(packInfo.length, 1, 'npm pack must produce one artifact');
|
|
123
166
|
const tarball = join(proofRoot, packInfo[0].filename);
|
|
124
167
|
assert.ok(existsSync(tarball), `packed artifact missing: ${tarball}`);
|
|
125
168
|
const unpackRoot = join(proofRoot, 'unpacked');
|
|
126
169
|
mkdirSync(unpackRoot);
|
|
127
|
-
execFileSync('tar', [
|
|
128
|
-
'-xzf',
|
|
129
|
-
tarball,
|
|
130
|
-
'-C',
|
|
131
|
-
unpackRoot
|
|
132
|
-
]);
|
|
170
|
+
execFileSync('tar', ['-xzf', tarball, '-C', unpackRoot]);
|
|
133
171
|
const packageRoot = join(unpackRoot, 'package');
|
|
134
172
|
symlinkSync(join(repoRoot, 'node_modules'), join(packageRoot, 'node_modules'), process.platform === 'win32' ? 'junction' : 'dir');
|
|
135
|
-
return {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
-
} catch (error) {
|
|
140
|
-
rmSync(proofRoot, {
|
|
141
|
-
recursive: true,
|
|
142
|
-
force: true
|
|
143
|
-
});
|
|
173
|
+
return { packageRoot, proofRoot };
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
rmSync(proofRoot, { recursive: true, force: true });
|
|
144
177
|
throw error;
|
|
145
178
|
}
|
|
146
179
|
}
|
|
147
180
|
const cleanInstalledBin = process.env.GOTRY_MAP_TOOLS_E2E_BIN;
|
|
148
181
|
const { packageRoot, proofRoot } = prepareProofPackage(cleanInstalledBin);
|
|
149
182
|
try {
|
|
150
|
-
|
|
183
|
+
assertPackagingExcludesNodeModules();
|
|
184
|
+
const lockedDsh = assertTargetLockClosure();
|
|
151
185
|
const vendorRoot = join(packageRoot, 'ts/dsh-runtime/vendor/dsh-map-tools');
|
|
152
186
|
const requiredFiles = [
|
|
153
187
|
'LICENSE',
|
|
@@ -158,119 +192,157 @@ try {
|
|
|
158
192
|
'lib/config.js',
|
|
159
193
|
'lib/tools/geocode.js',
|
|
160
194
|
'lib/tools/routes.js',
|
|
161
|
-
'lib/tools/poi.js'
|
|
195
|
+
'lib/tools/poi.js',
|
|
162
196
|
];
|
|
163
|
-
for (const relative of requiredFiles){
|
|
197
|
+
for (const relative of requiredFiles) {
|
|
164
198
|
assert.ok(existsSync(join(vendorRoot, relative)), `required vendor file missing: ${relative}`);
|
|
165
199
|
}
|
|
166
200
|
const vendorTree = vendorAggregate(vendorRoot);
|
|
167
201
|
assert.equal(vendorTree.count, upstreamVendorFileCount, 'vendored payload file count drifted');
|
|
168
|
-
assert.equal(vendorTree.sha256,
|
|
202
|
+
assert.equal(vendorTree.sha256, adaptedVendorAggregateSha256, 'vendored payload aggregate drifted');
|
|
169
203
|
const vendorPackage = JSON.parse(readFileSync(join(vendorRoot, 'package.json'), 'utf8'));
|
|
170
204
|
assert.equal(vendorPackage.name, 'dsh-map-tools');
|
|
171
205
|
assert.equal(vendorPackage.version, '0.5.1');
|
|
172
206
|
assert.equal(vendorPackage.license, 'MIT');
|
|
173
207
|
assert.equal(sha256(join(vendorRoot, 'LICENSE')), upstreamLicenseSha256, 'upstream MIT license changed');
|
|
174
208
|
const packageRequire = createRequire(join(packageRoot, 'package.json'));
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
assert.equal(
|
|
209
|
+
const dshToolsPackageJson = packageRequire.resolve('@deepseek-ai/dsh-tools/package.json');
|
|
210
|
+
const dshSettingsPackageJson = packageRequire.resolve('@deepseek-ai/dsh-settings/package.json');
|
|
211
|
+
const dshTools = JSON.parse(readFileSync(dshToolsPackageJson, 'utf8'));
|
|
212
|
+
const dshSettings = JSON.parse(readFileSync(dshSettingsPackageJson, 'utf8'));
|
|
213
|
+
assert.equal(dshTools.version, '0.1.5-rc.1');
|
|
214
|
+
assert.equal(dshSettings.version, '0.1.5-rc.1');
|
|
215
|
+
const settingsApi = await import(pathToFileURL(join(dirname(dshSettingsPackageJson), 'lib/index.js')).href);
|
|
216
|
+
const installSection = settingsApi.SettingsProvider?.prototype?.installSection;
|
|
217
|
+
assert.equal(typeof installSection, 'function', 'real 0.1.5-rc.1 SettingsProvider.prototype.installSection must be present');
|
|
181
218
|
const plugin = await import(pathToFileURL(join(vendorRoot, 'lib/index.js')).href);
|
|
182
|
-
const registered =
|
|
183
|
-
const
|
|
219
|
+
const registered = new Map();
|
|
220
|
+
const registerEvents = [];
|
|
221
|
+
const toolDisposeEvents = [];
|
|
222
|
+
const settingsRegistrations = [];
|
|
223
|
+
const settingsWatchers = [];
|
|
224
|
+
const settingsProviderDisposers = [];
|
|
225
|
+
const contextDisposers = [];
|
|
226
|
+
const settingsNamespaceValue = 'dsh-map-tools';
|
|
227
|
+
const activeToolNames = () => [...registered.keys()].sort();
|
|
228
|
+
const settingsProvider = {
|
|
229
|
+
ctx: {
|
|
230
|
+
effect(effect) {
|
|
231
|
+
const disposer = effect();
|
|
232
|
+
if (typeof disposer === 'function')
|
|
233
|
+
settingsProviderDisposers.push(disposer);
|
|
234
|
+
return disposer;
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
register: (...args) => {
|
|
238
|
+
settingsRegistrations.push(args);
|
|
239
|
+
return {
|
|
240
|
+
get: () => args[2] && typeof args[2] === 'object' ? args[2].base : undefined,
|
|
241
|
+
watch: (callback) => {
|
|
242
|
+
settingsWatchers.push(callback);
|
|
243
|
+
return () => {
|
|
244
|
+
const index = settingsWatchers.indexOf(callback);
|
|
245
|
+
if (index >= 0)
|
|
246
|
+
settingsWatchers.splice(index, 1);
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
update: async () => undefined,
|
|
250
|
+
replace: async () => undefined,
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
installSection: (...args) => installSection.apply(settingsProvider, args),
|
|
254
|
+
};
|
|
184
255
|
const context = {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
256
|
+
fiber: { state: 'active' },
|
|
257
|
+
effect(effect) {
|
|
258
|
+
const disposer = effect();
|
|
259
|
+
if (typeof disposer === 'function')
|
|
260
|
+
contextDisposers.push(disposer);
|
|
261
|
+
return disposer;
|
|
190
262
|
},
|
|
191
|
-
|
|
192
|
-
|
|
263
|
+
tools: {
|
|
264
|
+
register(tool) {
|
|
265
|
+
assert.ok(tool.name.startsWith('map_'), `unexpected map tool name: ${tool.name}`);
|
|
266
|
+
registered.set(tool.name, tool);
|
|
267
|
+
registerEvents.push(tool.name);
|
|
268
|
+
return () => {
|
|
269
|
+
registered.delete(tool.name);
|
|
270
|
+
toolDisposeEvents.push(tool.name);
|
|
271
|
+
};
|
|
272
|
+
},
|
|
193
273
|
},
|
|
194
|
-
inject
|
|
274
|
+
inject(dependencies, callback) {
|
|
195
275
|
if (dependencies.includes('settings')) {
|
|
196
|
-
callback({
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
});
|
|
203
|
-
} else if (dependencies.includes('webServer')) {
|
|
204
|
-
callback({
|
|
205
|
-
webServer: {
|
|
206
|
-
register: ()=>undefined
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
} else {
|
|
276
|
+
callback({ settings: settingsProvider });
|
|
277
|
+
}
|
|
278
|
+
else if (dependencies.includes('webServer')) {
|
|
279
|
+
callback({ webServer: { register: () => undefined } });
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
210
282
|
throw new Error(`unexpected dependency injection: ${dependencies.join(',')}`);
|
|
211
283
|
}
|
|
212
|
-
}
|
|
284
|
+
},
|
|
213
285
|
};
|
|
214
286
|
plugin.apply(context, {
|
|
215
|
-
provider: 'osm',
|
|
216
|
-
|
|
217
|
-
timeoutMs: 1000,
|
|
218
|
-
maxQps: 2,
|
|
219
|
-
defaultMode: 'driving',
|
|
220
|
-
language: 'zh'
|
|
287
|
+
provider: 'osm', amapKey: '', timeoutMs: 1000, maxQps: 2,
|
|
288
|
+
defaultMode: 'driving', language: 'zh',
|
|
221
289
|
});
|
|
222
|
-
assert.deepEqual(
|
|
223
|
-
assert.equal(
|
|
224
|
-
assert.equal(
|
|
225
|
-
assert.equal(
|
|
290
|
+
assert.deepEqual(activeToolNames(), expectedTools, 'exactly seven active map tools must register');
|
|
291
|
+
assert.equal(registerEvents.length, expectedTools.length * 2, 'installSection initial onChange must rebuild the map tools once');
|
|
292
|
+
assert.equal(toolDisposeEvents.length, expectedTools.length, 'installSection initial reload must dispose the first tool generation');
|
|
293
|
+
assert.equal(settingsRegistrations.length, 1, '0.1.5-rc.1 settings section must register once');
|
|
294
|
+
assert.equal(settingsRegistrations[0][0], settingsNamespaceValue, 'settings namespace must be the stable plain string');
|
|
295
|
+
assert.equal(settingsRegistrations[0][2] && typeof settingsRegistrations[0][2] === 'object', true, '0.1.5-rc.1 settings register options must be supplied');
|
|
296
|
+
assert.deepEqual(Object.keys(settingsRegistrations[0][2]).sort(), ['base'], '0.1.5-rc.1 registration must carry the composition base');
|
|
297
|
+
assert.equal(settingsWatchers.length, 1, '0.1.5-rc.1 installSection must attach one settings watcher');
|
|
298
|
+
assert.equal(settingsProviderDisposers.length, 1, '0.1.5-rc.1 installSection must attach one provider-detach fallback effect');
|
|
299
|
+
settingsWatchers[0]();
|
|
300
|
+
assert.deepEqual(activeToolNames(), expectedTools, 'settings watch reload must keep exactly seven active map tools');
|
|
301
|
+
assert.equal(registerEvents.length, expectedTools.length * 3, 'settings watch must rebuild the map tools');
|
|
302
|
+
assert.equal(toolDisposeEvents.length, expectedTools.length * 2, 'settings watch reload must dispose the previous generation');
|
|
303
|
+
settingsProviderDisposers[0]();
|
|
304
|
+
assert.deepEqual(activeToolNames(), expectedTools, 'settings provider detach fallback must keep exactly seven active map tools');
|
|
305
|
+
assert.equal(registerEvents.length, expectedTools.length * 4, 'provider detach fallback must rebuild the map tools');
|
|
306
|
+
assert.equal(toolDisposeEvents.length, expectedTools.length * 3, 'provider detach fallback must dispose the previous generation');
|
|
307
|
+
const finalActiveTools = [...registered.values()];
|
|
226
308
|
const originalFetch = globalThis.fetch;
|
|
227
|
-
globalThis.fetch = async ()=>{
|
|
228
|
-
throw new Error('network forbidden by package proof');
|
|
229
|
-
};
|
|
309
|
+
globalThis.fetch = (async () => { throw new Error('network forbidden by package proof'); });
|
|
230
310
|
try {
|
|
231
|
-
const geocode = registered.
|
|
311
|
+
const geocode = registered.get('map_geocode');
|
|
232
312
|
assert.ok(geocode, 'map_geocode must be registered');
|
|
233
|
-
const result = await geocode.execute({
|
|
234
|
-
address: '116.397428,39.90923'
|
|
235
|
-
}, {
|
|
236
|
-
signal: new AbortController().signal
|
|
237
|
-
});
|
|
313
|
+
const result = await geocode.execute({ address: '116.397428,39.90923' }, { signal: new AbortController().signal });
|
|
238
314
|
assert.equal(result.provider, 'inline');
|
|
239
|
-
assert.deepEqual(result.location, [
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
]);
|
|
243
|
-
} finally{
|
|
315
|
+
assert.deepEqual(result.location, [116.397428, 39.90923]);
|
|
316
|
+
}
|
|
317
|
+
finally {
|
|
244
318
|
globalThis.fetch = originalFetch;
|
|
245
319
|
}
|
|
320
|
+
for (const dispose of contextDisposers.splice(0).reverse())
|
|
321
|
+
dispose();
|
|
322
|
+
assert.equal(registered.size, 0, 'plugin unload must dispose the active map tool generation');
|
|
246
323
|
console.log(JSON.stringify({
|
|
247
324
|
proof: 'map-tools-vendor-package',
|
|
248
325
|
status: 'PASS',
|
|
249
326
|
artifactMode: cleanInstalledBin ? 'clean-installed-tarball' : 'packed-unpacked-focused',
|
|
250
327
|
vendored: {
|
|
251
328
|
sourcePackage: 'dsh-map-tools@0.5.1',
|
|
252
|
-
licenseSha256: upstreamLicenseSha256,
|
|
253
|
-
|
|
254
|
-
vendorAggregateSha256: vendorTree.sha256
|
|
329
|
+
licenseSha256: upstreamLicenseSha256, vendorFileCount: vendorTree.count,
|
|
330
|
+
adaptedVendorAggregateSha256: vendorTree.sha256,
|
|
255
331
|
},
|
|
256
332
|
artifactVendor: vendorRoot,
|
|
257
|
-
dshClosure: {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
333
|
+
dshClosure: { tools: dshTools.version, settings: dshSettings.version, ...lockedDsh },
|
|
334
|
+
settingsLifecycle: {
|
|
335
|
+
registerEvents: registerEvents.length,
|
|
336
|
+
toolDisposeEvents: toolDisposeEvents.length,
|
|
337
|
+
watchedReloads: 1,
|
|
338
|
+
providerDetachFallbacks: 1,
|
|
339
|
+
pluginUnloadDisposed: true,
|
|
261
340
|
},
|
|
262
|
-
tools:
|
|
263
|
-
inlineCoordinate: {
|
|
264
|
-
provider: 'inline',
|
|
265
|
-
network: 'forbidden'
|
|
266
|
-
}
|
|
341
|
+
tools: finalActiveTools.map(tool => tool.name).sort(),
|
|
342
|
+
inlineCoordinate: { provider: 'inline', network: 'forbidden' },
|
|
267
343
|
}, null, 2));
|
|
268
|
-
} finally{
|
|
269
|
-
if (proofRoot) rmSync(proofRoot, {
|
|
270
|
-
recursive: true,
|
|
271
|
-
force: true
|
|
272
|
-
});
|
|
273
344
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
345
|
+
finally {
|
|
346
|
+
if (proofRoot)
|
|
347
|
+
rmSync(proofRoot, { recursive: true, force: true });
|
|
348
|
+
}
|