dsh-ptc-plus 0.4.2 → 0.4.8

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.
Files changed (89) hide show
  1. package/README.en.md +170 -76
  2. package/README.md +171 -77
  3. package/assets/dsh-ptc-plus-banner-en.webp +0 -0
  4. package/assets/dsh-ptc-plus-banner-zh.webp +0 -0
  5. package/assets/ptc-plus-icon.svg +5 -0
  6. package/client.js +599 -310
  7. package/compiler-core.cjs +162 -160
  8. package/compiler-core.cjs.map +3 -3
  9. package/docs/README.md +4 -1
  10. package/docs/adr/0005-temporary-rejected-cell-edit-transport.md +49 -11
  11. package/docs/adr/0008-define-agent-operating-contract.md +2 -2
  12. package/docs/adr/0010-session-log-derived-recovery-tips.md +7 -0
  13. package/docs/adr/0016-archive-resolved-review-findings.md +3 -3
  14. package/docs/adr/0017-track-the-latest-dsh-public-surface.md +5 -1
  15. package/docs/adr/0019-plugin-settings-and-kill-switch.md +3 -3
  16. package/docs/adr/0020-optional-cordis-tools-in-ptc-mode.md +3 -1
  17. package/docs/adr/0021-separate-host-bootstrap-from-session-runtime.md +14 -3
  18. package/docs/adr/0023-global-user-bindings.md +1 -1
  19. package/docs/adr/0026-persist-the-delivery-verdict-against-the-verified-candidate.md +23 -7
  20. package/docs/adr/0027-run-the-session-kernel-in-a-killable-helper-process.md +4 -0
  21. package/docs/adr/0028-attach-to-the-host-ptc-execution-seam.md +26 -6
  22. package/docs/adr/0030-serve-both-typert-codec-generations-from-one-codec.md +2 -2
  23. package/docs/adr/0031-close-semantic-obligations-by-owner.md +29 -0
  24. package/docs/adr/README.md +4 -4
  25. package/docs/architecture.md +8 -5
  26. package/docs/binding-review-placement-design.md +1 -1
  27. package/docs/client-ui.md +8 -4
  28. package/docs/durability-design.md +7 -7
  29. package/docs/installation.md +48 -12
  30. package/docs/publishing.md +4 -4
  31. package/docs/release-notes.md +109 -0
  32. package/docs/runtime-reference.md +25 -12
  33. package/docs/semantic-validation.md +7 -3
  34. package/docs/user-bindings.en.md +7 -6
  35. package/docs/user-bindings.md +6 -5
  36. package/docs/value-wire.md +1 -1
  37. package/docs/verification.md +43 -2
  38. package/index.js +39 -34
  39. package/internal/async-local-storage-intrinsics.js +12 -7
  40. package/internal/callable-source-facts.js +37 -1
  41. package/internal/cell-analysis.js +64 -9
  42. package/internal/config-spec.js +1 -1
  43. package/internal/cordis-tools-owner.js +81 -15
  44. package/internal/direct-surface-owner.js +331 -7
  45. package/internal/edit-transport-owner.js +80 -20
  46. package/internal/execution-seam-compat.js +192 -30
  47. package/internal/kernel-worker.js +162 -72
  48. package/internal/message-sources.js +14 -0
  49. package/internal/module-compilation.js +2 -1
  50. package/internal/rejected-cell-editor.js +11 -21
  51. package/internal/repl-memory-projection.js +10 -0
  52. package/internal/repl-scope-normalizer.js +72 -35
  53. package/internal/repl-value-observer.js +141 -45
  54. package/internal/runtime-config.js +62 -2
  55. package/internal/runtime-intrinsics.js +3 -0
  56. package/internal/runtime-messages.js +6 -4
  57. package/internal/session-cell-executor.js +24 -1
  58. package/internal/session-journal-recovery.js +267 -67
  59. package/internal/session-journal.js +466 -40
  60. package/internal/session-log-view.js +5 -4
  61. package/internal/session-runtime.js +45 -21
  62. package/internal/session-state.js +7 -29
  63. package/internal/settings-compat.js +66 -1
  64. package/internal/source-position-map.js +19 -0
  65. package/internal/user-binding-console-worker.js +23 -9
  66. package/internal/user-binding-draft-projection.js +3 -2
  67. package/internal/user-bindings-owner.js +2 -1
  68. package/internal/user-bindings.js +6 -1
  69. package/internal/validated-parse-repair.js +6 -2
  70. package/internal/value-wire.js +95 -30
  71. package/internal/worker-client.js +99 -8
  72. package/internal/worker-cwd-virtualization.js +10 -9
  73. package/internal/worker-output-capture.js +187 -0
  74. package/internal/worker-output-fence.js +26 -0
  75. package/internal/worker-realm-surfaces.js +197 -0
  76. package/internal/worker-repl-realm.js +10 -4
  77. package/package.json +42 -4
  78. package/src/client-activity.js +4 -1
  79. package/src/client-authoring-view.js +121 -62
  80. package/src/client-console.js +4 -2
  81. package/src/client-copy.js +4 -2
  82. package/src/client-feature-gates.js +7 -9
  83. package/src/client-host-compat.js +104 -27
  84. package/src/client-repl-view.js +3 -1
  85. package/src/client-styles.js +12 -1
  86. package/src/client-tool-view.js +3 -1
  87. package/src/client-transport.js +2 -2
  88. package/src/client-workbench.js +10 -7
  89. package/src/client.js +56 -17
@@ -1,4 +1,5 @@
1
1
  import { blankBinding, editableBinding, bindingPayload } from './client-bindings-data.js'
2
+ import { isHostIconComponent } from './client-host-compat.js'
2
3
 
3
4
  /**
4
5
  * User Bindings workbench. The controller owns every piece of edit state in one
@@ -320,7 +321,7 @@ export function createUserBindingsWorkbench(React, deps) {
320
321
  h(ActionButton, {
321
322
  type: 'button', className: 'ptcPlusButton', 'data-kind': 'primary', disabled: !canCreate,
322
323
  onClick: create,
323
- }, typeof icons.plus === 'function' ? h(icons.plus, { size: 16 }) : null, t('bindings.new')))),
324
+ }, isHostIconComponent(icons.plus) ? h(icons.plus, { size: 16 }) : null, t('bindings.new')))),
324
325
  state.catalog === null
325
326
  ? h('p', {
326
327
  // A failed read publishes its error on the shared source; without it
@@ -333,7 +334,7 @@ export function createUserBindingsWorkbench(React, deps) {
333
334
  : h('div', { className: 'ptcPlusBindingsGrid' },
334
335
  h('div', { className: 'ptcPlusBindingPane' },
335
336
  h('label', { className: 'ptcPlusSearch' },
336
- typeof icons.search === 'function' ? h(icons.search, { size: 16 }) : null,
337
+ isHostIconComponent(icons.search) ? h(icons.search, { size: 16 }) : null,
337
338
  h('input', { value: state.query, onChange: event => patch({ query: event.target.value }),
338
339
  placeholder: t('bindings.search'), 'aria-label': t('bindings.search') })),
339
340
  state.catalog.error === undefined
@@ -414,7 +415,7 @@ export function createUserBindingsWorkbench(React, deps) {
414
415
  h('span', { className: 'ptcPlusSourceFilename' }, state.draft.name ? `${state.draft.name}.ts` : '')),
415
416
  h('div', { className: 'ptcPlusSourceActions' }, state.editing ? null
416
417
  : h(ActionButton, { disabled: state.busy, onClick: () => patch({ editing: true, sourceOpen: true }) },
417
- typeof icons.edit === 'function' ? h(icons.edit, { size: 14 }) : null, t('bindings.edit'))),
418
+ isHostIconComponent(icons.edit) ? h(icons.edit, { size: 14 }) : null, t('bindings.edit'))),
418
419
  h('div', { className: 'ptcPlusSourceBody', hidden: !state.sourceOpen },
419
420
  state.editing
420
421
  ? h(TypeScriptEditor, { documentId: state.documentId, value: state.draft.source, disabled: state.busy,
@@ -483,11 +484,13 @@ export function createUserBindingsWorkbench(React, deps) {
483
484
  const content = React.useRef(null)
484
485
  const localReturnFocus = React.useRef(null)
485
486
  const returnFocus = returnFocusRef ?? localReturnFocus
486
- React.useEffect(() => {
487
+ const attachContent = React.useCallback(element => {
488
+ content.current = element
489
+ if (element === null) return
487
490
  const previous = document.activeElement
488
491
  // A resumed mount may have no focused control; keep the last valid entry.
489
- if (!content.current.contains(previous) && canReturnFocus(previous)) returnFocus.current = previous
490
- content.current.querySelector('button')?.focus()
492
+ if (!element.contains(previous) && canReturnFocus(previous)) returnFocus.current = previous
493
+ element.querySelector('button')?.focus()
491
494
  }, [returnFocus])
492
495
  const close = () => {
493
496
  const target = canReturnFocus(returnFocus.current) ? returnFocus.current : getReturnFocus?.()
@@ -508,7 +511,7 @@ export function createUserBindingsWorkbench(React, deps) {
508
511
  }
509
512
  }
510
513
  return h(Modal, { open: true, onClose: close, title: t('bindings.title'), headless: true, className: 'ptcPlusBindingsModal' },
511
- h('div', { className: 'ptcPlusBindingsDialog', ref: content, onKeyDown: trapFocus },
514
+ h('div', { className: 'ptcPlusBindingsDialog', ref: attachContent, onKeyDown: trapFocus },
512
515
  h('div', { className: 'ptcPlusBindingsDialogHead' },
513
516
  h('h2', null, t('bindings.title')),
514
517
  h('button', { type: 'button', className: 'ptcPlusDialogClose', onClick: close,
package/src/client.js CHANGED
@@ -9,6 +9,9 @@ import { createIndicatorView } from './client-indicator-view.js'
9
9
  import { createTypeScriptEditor } from './client-code-editor.js'
10
10
  import { createBindingConsole } from './client-console.js'
11
11
  import {
12
+ createMenuChildrenEvidence,
13
+ hostIconComponents,
14
+ isHostIconComponent,
12
15
  isIdleSessionComposer,
13
16
  publishSettingsCard,
14
17
  sessionUsesPtcPreset,
@@ -32,34 +35,37 @@ window.__ModuleLoader__.load({
32
35
  id: __PTC_PLUS_CLIENT_MODULE_ID__,
33
36
  factory: (require) => {
34
37
  const React = require('react')
38
+ const primitives = require('@deepseek-ai/dsh-client-ui-primitives')
35
39
  const {
36
40
  Button,
37
41
  CodeBlock,
38
42
  DisclosureRow,
39
- IconCheckOutline14,
40
- IconChevronDownOutline14,
41
- IconInspectOutline12,
42
- IconSparkle16,
43
- IconCloseOutline16,
44
- IconSearchOutline16,
45
- IconPlusOutline16,
46
- IconRefreshOutline16,
47
- IconTrashOutline16,
48
- IconEditOutline16,
49
- IconPlayOutline16,
50
- IconStopFill16,
51
43
  Menu,
52
44
  Modal,
53
45
  Toast,
54
46
  Tooltip,
55
- } = require('@deepseek-ai/dsh-client-ui-primitives')
47
+ } = primitives
48
+ const {
49
+ check: IconCheckOutline14,
50
+ chevron: IconChevronDownOutline14,
51
+ inspect: IconInspectOutline12,
52
+ sparkle: IconSparkle16,
53
+ close: IconCloseOutline16,
54
+ search: IconSearchOutline16,
55
+ plus: IconPlusOutline16,
56
+ refresh: IconRefreshOutline16,
57
+ trash: IconTrashOutline16,
58
+ edit: IconEditOutline16,
59
+ play: IconPlayOutline16,
60
+ stop: IconStopFill16,
61
+ } = hostIconComponents(primitives)
56
62
  const module = { exports: {} }
57
63
  const h = React.createElement
58
64
  const TypeScriptEditor = createTypeScriptEditor(React)
59
65
 
60
66
  function IconButton({ icon: Icon, label, ...props }) {
61
67
  const button = h('button', { ...props, type: 'button', className: 'ptcPlusIconButton',
62
- 'aria-label': label, title: label }, typeof Icon === 'function' ? h(Icon, { size: 16 }) : label)
68
+ 'aria-label': label, title: label }, isHostIconComponent(Icon) ? h(Icon, { size: 16 }) : label)
63
69
  return typeof Tooltip === 'function' ? h(Tooltip, { label, delayMs: 400 }, button) : button
64
70
  }
65
71
 
@@ -79,9 +85,40 @@ window.__ModuleLoader__.load({
79
85
  icons: { chevron: IconChevronDownOutline14, check: IconCheckOutline14, inspect: IconInspectOutline12 },
80
86
  })
81
87
 
88
+ /**
89
+ * Resolve the settings transport of the running generation. The current
90
+ * release publishes `configForms`; the preceding one published
91
+ * `settingsScope`. Both are optional child injections so the client entry
92
+ * does not stay pending on the name the installed generation does not use.
93
+ */
94
+ function settingsPreferenceScope(ctx) {
95
+ return new Promise((resolve, reject) => {
96
+ let settled = false
97
+ let configFormsWatcher
98
+ let settingsScopeWatcher
99
+ const take = (name, scope) => {
100
+ if (settled) return
101
+ settled = true
102
+ if (name !== 'configForms' && typeof configFormsWatcher === 'function') configFormsWatcher()
103
+ if (name !== 'settingsScope' && typeof settingsScopeWatcher === 'function') settingsScopeWatcher()
104
+ resolve(name === 'configForms'
105
+ ? scope.configForms.get(SETTINGS_NAMESPACE)
106
+ : scope.settingsScope.bind({ namespace: SETTINGS_NAMESPACE }))
107
+ }
108
+ try {
109
+ configFormsWatcher = ctx.inject(['configForms'], scope => take('configForms', scope))
110
+ if (!settled) {
111
+ settingsScopeWatcher = ctx.inject(['settingsScope'], scope => take('settingsScope', scope))
112
+ }
113
+ } catch (error) {
114
+ reject(error)
115
+ }
116
+ })
117
+ }
118
+
82
119
  async function apply(ctx) {
83
120
  const rpc = await createClientRpc(ctx)
84
- const preferenceScope = ctx.settingsScope.bind({ namespace: SETTINGS_NAMESPACE })
121
+ const preferenceScope = await settingsPreferenceScope(ctx)
85
122
  ctx.effect(() => ctx.locale.register(LOCALE_NS, SETTINGS_COPY), 'ptc-plus: settings dictionaries')
86
123
  ctx.effect(installStyles, 'ptc-plus: client styles')
87
124
 
@@ -215,10 +252,12 @@ window.__ModuleLoader__.load({
215
252
  }
216
253
 
217
254
  const subscribeReset = listener => ctx.on('connection/reset', listener)
255
+ // One probe answer serves every session's composer entry for this Client.
256
+ const menuChildren = createMenuChildrenEvidence()
218
257
  const { BindingAuthorButton, BindingReviewDock, BindingCommandCard } = createAuthoringView(React, {
219
258
  ActionButton, IconButton, Menu, Toast, Tooltip, CodeBlock, BindingsDialog, PTCPlusSettingsDialog,
220
259
  useWorkbenchController, useBindingReview, catalogOwner, callUserBindings, subscribeReset,
221
- settingsCardSeat: settingsCard.seat, updateSetting,
260
+ settingsCardSeat: settingsCard.seat, updateSetting, menuChildren,
222
261
  icons: {
223
262
  sparkle: IconSparkle16, chevron: IconChevronDownOutline14,
224
263
  close: IconCloseOutline16, check: IconCheckOutline14,
@@ -274,7 +313,7 @@ window.__ModuleLoader__.load({
274
313
 
275
314
  module.exports = {
276
315
  apply,
277
- inject: ['settingsScope', 'slots', 'locale', 'connection', 'remote'],
316
+ inject: ['slots', 'locale', 'connection', 'remote'],
278
317
  }
279
318
  return module.exports
280
319
  },