dsh-labscript 0.2.2 → 0.2.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3
4
+
5
+ - Fix: labs_status now prints panel values. keys=[...] and raw=true were accepted but the
6
+ rendered summary never showed any global, so the model could only see the key count
7
+ (the tool result content is the render output; the returned object is not in context).
8
+ With keys the selected values are printed (240 chars each, <missing> when absent);
9
+ without keys it prints the count and a hint to pass keys.
10
+ - Tests: labs_status value rendering (values, count-only, missing keys).
11
+
3
12
  ## 0.2.2
4
13
 
5
14
  - Fix: labs_status and labs_engage report pathMap-mapped paths. `labs_status.labscript`
package/README.md CHANGED
@@ -125,7 +125,7 @@ is not a physics simulation.
125
125
  ## Development
126
126
 
127
127
  npm install # only runtime dependency: yaml
128
- npm test # node --test, 35 tests (fake bridge, no python needed)
128
+ npm test # node --test, 36 tests (fake bridge, no python needed)
129
129
  python python/tests/run_tests.py # 15 tests (needs numpy + h5py)
130
130
  LABSCRIPT_PYTHON=/path/to/python3 node scripts/demo.mjs # end-to-end mock demo
131
131
 
package/lib/tools.js CHANGED
@@ -35,6 +35,30 @@ function progressLine(run) {
35
35
  return parts.join(' ')
36
36
  }
37
37
 
38
+ // The bridge returns the whole panel; without this the summary alone hides it.
39
+ function globalText(value, limit = 240) {
40
+ let rendered
41
+ try { rendered = JSON.stringify(value) } catch { rendered = String(value) }
42
+ if (rendered === undefined) rendered = String(value)
43
+ return rendered.length > limit ? rendered.slice(0, limit) + '…' : rendered
44
+ }
45
+
46
+ function globalLines(args, value) {
47
+ const globals = value.globals || {}
48
+ const keys = Array.isArray(args.keys) ? args.keys : []
49
+ if (keys.length === 0) {
50
+ const count = Object.keys(globals).length
51
+ return [count > 0 ? 'globals: ' + count + ' keys (pass keys=[...] to read values)' : 'globals: none']
52
+ }
53
+ const raw = args.raw === true && value.raw_globals ? value.raw_globals : null
54
+ const out = ['globals:']
55
+ for (const key of keys) {
56
+ const shown = raw ? raw[key] : globals[key]
57
+ out.push(' ' + key + ' = ' + (shown === undefined ? '<missing>' : globalText(shown)))
58
+ }
59
+ return out
60
+ }
61
+
38
62
  async function pendingProgress(runtime, exec) {
39
63
  const pending = runtime.state.pending
40
64
  if (!pending) return null
@@ -105,7 +129,7 @@ export function registerTools(ctx, runtime) {
105
129
 
106
130
  ctx.tools.register({
107
131
  name: 'labs_status',
108
- description: 'Read the labscript runmanager panel: loaded labscript, globals (evaluated; raw expressions with raw=true), n_shots, error_in_globals, run_shots, shot output folder, pending run progress, and the panel snapshot directory. Read-only; call this before any write. Paths in the output are already mapped for this machine through pathMap; do not map them again.',
132
+ description: 'Read the labscript runmanager panel: loaded labscript, globals (evaluated; raw expressions with raw=true), n_shots, error_in_globals, run_shots, shot output folder, pending run progress, and the panel snapshot directory. Read-only; call this before any write. Pass keys=[...] to print the selected panel values (240 chars each; raw=true prints the raw expression). Paths in the output are already mapped for this machine through pathMap; do not map them again.',
109
133
  parameters: {
110
134
  type: 'object',
111
135
  properties: {
@@ -115,13 +139,14 @@ export function registerTools(ctx, runtime) {
115
139
  additionalProperties: false,
116
140
  },
117
141
  isConcurrencySafe: () => true,
118
- output: looseOutput((_args, value) => text(lines([
142
+ output: looseOutput((args, value) => text(lines([
119
143
  'backend: ' + value.backend + ' plugin: v' + runtime.version,
120
144
  'labscript: ' + value.labscript,
121
145
  'shot output: ' + value.shot_output_folder,
122
146
  'n_shots: ' + value.n_shots + ' error_in_globals: ' + value.error_in_globals + ' run_shots: ' + value.run_shots,
123
147
  progressLine(value.last_run),
124
148
  'panel history: ' + (value.panel_history ? value.panel_history.dir + ' (' + value.panel_history.count + ' snapshots)' : 'n/a'),
149
+ ...globalLines(args, value),
125
150
  ]))),
126
151
  async execute(args, exec) {
127
152
  const data = await runtime.runBridge('status', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-labscript",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Control labscript-suite experiments from DeepSeek Harness: runmanager globals and scans, submits and waits, YAML fixed-operation protocols with postprocess write-back, panel snapshots, a built-in mock backend and a read-only doctor.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",