dsh-ptc-plus 0.4.8 → 0.5.0
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.en.md +61 -123
- package/README.md +61 -123
- package/assets/dsh-ptc-plus-banner-en.webp +0 -0
- package/assets/dsh-ptc-plus-banner-zh.webp +0 -0
- package/assets/ptc-plus-repl-workspace-en.png +0 -0
- package/assets/ptc-plus-repl-workspace-zh.png +0 -0
- package/assets/ptc-plus-settings-en.png +0 -0
- package/assets/ptc-plus-settings-zh.png +0 -0
- package/client.cjs +42336 -0
- package/cordis.patch.yml +13 -2
- package/docs/README.md +7 -2
- package/docs/adr/0005-temporary-rejected-cell-edit-transport.md +31 -179
- package/docs/adr/0008-define-agent-operating-contract.md +5 -1
- package/docs/adr/0009-bound-expensive-acceptance-default.md +2 -2
- package/docs/adr/0016-archive-resolved-review-findings.md +1 -1
- package/docs/adr/0017-track-the-latest-dsh-public-surface.md +2 -2
- package/docs/adr/0019-plugin-settings-and-kill-switch.md +14 -3
- package/docs/adr/0020-optional-cordis-tools-in-ptc-mode.md +2 -2
- package/docs/adr/0022-stage-npm-releases-with-oidc.md +4 -2
- package/docs/adr/0023-global-user-bindings.md +3 -1
- package/docs/adr/0026-persist-the-delivery-verdict-against-the-verified-candidate.md +2 -0
- package/docs/adr/0028-attach-to-the-host-ptc-execution-seam.md +101 -35
- package/docs/adr/0030-serve-both-typert-codec-generations-from-one-codec.md +3 -3
- package/docs/adr/0031-close-semantic-obligations-by-owner.md +1 -1
- package/docs/adr/0032-own-session-log-facts-in-a-host-only-projection.md +27 -0
- package/docs/adr/0033-gate-client-visual-usability-in-a-browser.md +23 -0
- package/docs/adr/0034-keep-program-values-separate-from-output-projections.md +29 -0
- package/docs/adr/0035-run-coverage-only-before-a-new-release.md +27 -0
- package/docs/adr/0036-separate-focused-development-from-delivery-verification.md +29 -0
- package/docs/adr/0037-keep-tool-hover-previews-passive.md +52 -0
- package/docs/adr/0038-freeze-session-capability-plans.md +71 -0
- package/docs/adr/0039-verify-documentation-without-runtime-suites.md +29 -0
- package/docs/adr/0040-separate-capability-configurations-from-session-observations.md +39 -0
- package/docs/adr/0041-record-cell-execution-directories.md +65 -0
- package/docs/adr/0042-persist-provider-availability-and-handback.md +41 -0
- package/docs/adr/0043-compose-capability-and-context-policies.md +37 -0
- package/docs/adr/README.md +6 -0
- package/docs/architecture.md +25 -27
- package/docs/binding-review-placement-design.md +29 -21
- package/docs/capability-planning-components.md +93 -0
- package/docs/capability-projection.md +7 -0
- package/docs/client-ui.md +88 -29
- package/docs/client-visual-contract.md +65 -0
- package/docs/context-management.md +22 -0
- package/docs/context-optimization-plan.md +353 -0
- package/docs/context-public-interface-coverage.md +25 -0
- package/docs/durability-design.md +31 -14
- package/docs/evaluation.md +41 -6
- package/docs/evaluations/command-goat-deepseek-v4.1-flash-20261006.md +126 -0
- package/docs/evaluations/command-goat-deepseek-v4.1-flash.md +281 -0
- package/docs/installation.md +50 -8
- package/docs/program-data-plane.md +5 -3
- package/docs/publishing.md +5 -5
- package/docs/release-coverage.md +73 -0
- package/docs/release-notes.md +1 -1
- package/docs/review-procedure.md +56 -0
- package/docs/runtime-reference.md +48 -16
- package/docs/semantic-validation.md +14 -2
- package/docs/stateful-binding-updates-proposal.md +2 -2
- package/docs/user-bindings.en.md +2 -2
- package/docs/user-bindings.md +3 -3
- package/docs/value-wire.md +11 -1
- package/docs/verification-optimization-work.md +52 -15
- package/docs/verification.md +30 -86
- package/index.js +147 -23
- package/internal/binding-toggle-receipt.js +24 -0
- package/internal/capability-command-receipt.js +29 -0
- package/internal/capability-environment.js +1247 -0
- package/internal/capability-plan.js +285 -0
- package/internal/capability-policy.js +96 -0
- package/internal/capability-statistics-store.js +180 -0
- package/internal/capability-statistics.js +210 -0
- package/internal/compiler-platform.js +5 -3
- package/internal/compiler-service.js +2 -9
- package/internal/config-spec.js +79 -9
- package/internal/cordis-tools-owner.js +22 -19
- package/internal/direct-surface-owner.js +29 -29
- package/internal/dynamic-environment-runtime.js +9 -9
- package/internal/edit-transport-owner.js +183 -139
- package/internal/execution-provider-owner.js +160 -0
- package/internal/execution-seam-compat.js +76 -120
- package/internal/isolated-worker.js +12 -8
- package/internal/kernel-worker.js +104 -32
- package/internal/native-root-dynamic.js +12 -13
- package/internal/program-bindings.js +190 -0
- package/internal/recovery-tips.js +53 -23
- package/internal/rejected-cell-editor.js +8 -8
- package/internal/repl-observation-interest.js +11 -3
- package/internal/rpc-contract.js +1 -0
- package/internal/runtime-bridge-owner.js +351 -82
- package/internal/runtime-config.js +58 -0
- package/internal/runtime-contexts.js +85 -16
- package/internal/runtime-intrinsics.js +1 -0
- package/internal/runtime-messages.js +41 -0
- package/internal/sdk-projection.js +10 -82
- package/internal/session-cell-executor.js +42 -19
- package/internal/session-events.js +74 -4
- package/internal/session-journal-recovery.js +904 -184
- package/internal/session-journal-schema.js +6 -3
- package/internal/session-journal.js +31 -2
- package/internal/session-log-view.js +189 -43
- package/internal/session-runtime.js +175 -23
- package/internal/settings-compat.js +23 -6
- package/internal/stateful-module-compiler.js +3 -2
- package/internal/stateful-module-runtime.js +7 -3
- package/internal/stateful-root-runtime.js +9 -4
- package/internal/user-binding-authoring.js +2 -7
- package/internal/user-bindings-owner.js +47 -7
- package/internal/validated-parse-repair.js +1 -1
- package/internal/value-wire.js +68 -21
- package/internal/worker-cwd-virtualization.js +20 -18
- package/internal/worker-realm-surfaces.js +3 -3
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +55 -38
- package/src/client-authoring-view.js +286 -168
- package/src/client-binding-review.js +4 -1
- package/src/client-binding-toggle.js +18 -0
- package/src/client-capabilities-view.js +1341 -0
- package/src/client-capability-sort.js +29 -0
- package/src/client-code-editor.js +6 -0
- package/src/client-copy.js +881 -8
- package/src/client-feature-gates.js +15 -5
- package/src/client-host-compat.js +23 -2
- package/src/client-indicator-view.js +4 -6
- package/src/client-primitives.js +280 -0
- package/src/client-repl-view.js +23 -16
- package/src/client-settings-view.js +412 -69
- package/src/client-styles.js +193 -41
- package/src/client-tool-hover.js +185 -0
- package/src/client-tool-view.js +45 -11
- package/src/client-transport.js +44 -9
- package/src/client-workbench.js +9 -10
- package/src/client.js +148 -68
- package/assets/ptc-plus-bindings-en.png +0 -0
- package/assets/ptc-plus-bindings-zh.png +0 -0
- package/assets/ptc-plus-repair-en.png +0 -0
- package/assets/ptc-plus-repair-zh.png +0 -0
- package/client.js +0 -31857
|
@@ -1,7 +1,77 @@
|
|
|
1
|
-
/** Read
|
|
1
|
+
/** Read an explicit observation or the historical array-backed session contract. */
|
|
2
2
|
export function sessionEvents(session) {
|
|
3
|
-
if (
|
|
4
|
-
|
|
3
|
+
if (session === undefined || session === null) return undefined
|
|
4
|
+
const events = session.events
|
|
5
|
+
if (Array.isArray(events)) return events
|
|
6
|
+
if (Object.hasOwn(session, 'events')) throw new Error('ptc-plus: legacy session.events is not an event array')
|
|
7
|
+
throw new Error('ptc-plus: session history requires a public sessionQuery observation')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function advanceSessionSurface(nodes, event) {
|
|
11
|
+
if (event?.surfaceOp === 'append') return [...nodes, event.seq]
|
|
12
|
+
if (event?.surfaceOp?.op !== 'replace') return nodes
|
|
13
|
+
const first = nodes.indexOf(event.surfaceOp.startSeq ?? event.surfaceOp.start)
|
|
14
|
+
const last = nodes.indexOf(event.surfaceOp.endSeq ?? event.surfaceOp.end)
|
|
15
|
+
if (first === -1 || last < first) return nodes
|
|
16
|
+
const next = [...nodes]
|
|
17
|
+
next.splice(first, last - first + 1, event.seq)
|
|
18
|
+
return next
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Read model source from the Host projection, independently of execution history. */
|
|
22
|
+
export function sessionSourceMessages(session, events, nodes) {
|
|
23
|
+
if (Array.isArray(session?.surface?.sourceMessages)) {
|
|
24
|
+
return new Map(session.surface.sourceMessages)
|
|
25
|
+
}
|
|
26
|
+
const visible = new Set(nodes)
|
|
27
|
+
const sources = new Map()
|
|
28
|
+
const messages = typeof session?.deriveMessages === 'function'
|
|
29
|
+
? session.deriveMessages()
|
|
30
|
+
: undefined
|
|
31
|
+
for (const event of events) {
|
|
32
|
+
if (event.type !== 'assistant/message' || !visible.has(event.seq)) continue
|
|
33
|
+
let message
|
|
34
|
+
if (typeof session?.deriveEventMessage === 'function') {
|
|
35
|
+
message = session.deriveEventMessage(event)
|
|
36
|
+
} else if (messages !== undefined) {
|
|
37
|
+
const id = event.data?.message?.id
|
|
38
|
+
const matches = typeof id === 'string' ? messages.filter(item => item.id === id) : []
|
|
39
|
+
if (matches.length === 1) message = matches[0]
|
|
40
|
+
} else if (Array.isArray(session?.events)) {
|
|
41
|
+
// The historical array-backed contract has no pure message projections.
|
|
42
|
+
message = event.data?.message
|
|
43
|
+
}
|
|
44
|
+
if (message !== undefined && message !== null) sources.set(event.seq, message)
|
|
45
|
+
}
|
|
46
|
+
return sources
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function readSessionLog(session, query, signal) {
|
|
50
|
+
if (session === undefined || session === null || Array.isArray(session.events)) return session
|
|
51
|
+
if (typeof query?.observeSession !== 'function') {
|
|
52
|
+
throw new Error('ptc-plus: sessionQuery.observeSession is unavailable for this session')
|
|
53
|
+
}
|
|
54
|
+
const observation = await query.observeSession(session.id, { signal, projectionMode: 'none' })
|
|
55
|
+
try {
|
|
56
|
+
if (!Array.isArray(observation.events)) throw new Error('ptc-plus: sessionQuery observation did not publish events')
|
|
57
|
+
let nodes = session.surface?.nodes
|
|
58
|
+
if (!Array.isArray(nodes) || session.seq - 1 !== observation.cursor) {
|
|
59
|
+
nodes = []
|
|
60
|
+
for (const event of observation.events) nodes = advanceSessionSurface(nodes, event)
|
|
61
|
+
}
|
|
62
|
+
// Do not pair an immutable raw cut with a newer live message projection.
|
|
63
|
+
// A cut without exact model-source evidence cannot retain old bindings.
|
|
64
|
+
const sources = session.seq - 1 === observation.cursor
|
|
65
|
+
? sessionSourceMessages(session, observation.events, nodes)
|
|
66
|
+
: new Map()
|
|
67
|
+
return Object.freeze({
|
|
68
|
+
id: session.id, header: observation.header, events: observation.events,
|
|
69
|
+
surface: Object.freeze({
|
|
70
|
+
nodes: Object.freeze([...nodes]),
|
|
71
|
+
sourceMessages: Object.freeze([...sources].map(entry => Object.freeze(entry))),
|
|
72
|
+
}),
|
|
73
|
+
})
|
|
74
|
+
} finally {
|
|
75
|
+
observation[Symbol.dispose]()
|
|
5
76
|
}
|
|
6
|
-
return session?.events
|
|
7
77
|
}
|