@abelxiaoxing/cadence 2.0.26 → 2.0.27

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.
@@ -3,7 +3,7 @@
3
3
  In a trusted Pi terminal or a WebUI conversation in an explicitly selected project, enter `/cadence <goal>` once (or `/cadence` to discuss the goal).
4
4
  Cadence stays enabled for the entire conversation, including after a goal finishes.
5
5
  Continue using normal messages; do not repeat the command for clarification or another goal.
6
- Type `退出 Cadence` or `exit cadence` (in Pi also `/cadence exit`) to leave the mode explicitly.
6
+ Type `退出 Cadence` or `exit cadence` (in Pi also `/cadence exit`) to leave the mode explicitly; in the browser the composer's **Cadence mode** switch enters it on the next Send and leaves it when on.
7
7
  Leaving, closing Pi/browser and switching conversations detach; they do not cancel accepted work.
8
8
  Browser conversation mode is retained by the project owner, not by a browser-only toggle, and works without a live Pi terminal.
9
9
 
@@ -34,8 +34,9 @@ When an observation reply is lost, ask for status; do not infer that the action
34
34
 
35
35
  The first native use defaults to the current Pi provider/model/API/thinking selection.
36
36
  The selected preference is remembered in `<agent-dir>/cadence/settings.json` (normally `~/.pi/agent/cadence/settings.json`) and reused across projects.
37
- Ask Cadence to change its model in Pi, or use **Model** in the browser.
38
- The browser restores an available saved preference on explicit Send; reads/login do not install a choice.
37
+ Ask Cadence to change its model in Pi, or use the model button beside the browser composer; it shows the current model and thinking level, and choosing from its list or thinking row takes effect at once for every conversation in the project.
38
+ The browser restores an available saved preference on explicit Send and shows it dimmed until then; reads/login do not install a choice.
39
+ With no choice and no saved preference, Send opens the model list and sends the message right after the choice.
39
40
  If no usable preference exists, choose once; an unreadable preference file falls back to the current Pi model, and choosing a model rewrites it.
40
41
  An accepted run keeps its original exact model.
41
42
  An unavailable remembered model is not silently substituted.
@@ -250,7 +250,7 @@ At sign-out or shutdown Windows ends the owner without orderly Stop: running wor
250
250
  - `alive` requires an authenticated exact-epoch reply.
251
251
  It is not a PID probe.
252
252
  `actions:false` can mean that no owner model has been explicitly selected yet.
253
- - Return, browser close and Pi quit detach clients; admitted work continues.
253
+ - Disconnect this page (the WebUI More menu), browser close and Pi quit detach clients; admitted work continues.
254
254
  Use the client's **Cancel** for a run or management **stop** for the service.
255
255
  - Stop closes admission and waits original processes, credential writes, history writes, already-started publication continuations, owned networking and listener closure before releasing fences.
256
256
  Checks, native process outcomes and human review remain separate facts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abelxiaoxing/cadence",
3
- "version": "2.0.26",
3
+ "version": "2.0.27",
4
4
  "description": "Conversation-driven Pi workspace: persistent native and WebUI workflows, explicit plan approval, checks and local delivery.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -2,5 +2,5 @@
2
2
  export const nativeBuild = {
3
3
  kind: "native",
4
4
  contractHash:
5
- "663f71a44cd33f95377644cfc10c2cb657298f191b36d6ca05b810e849c54e68",
5
+ "b6935a8daa09f70de094136c18d8e3588fdd34fc24b9a8fe95e465de11ddae8d",
6
6
  } as const;
@@ -46,6 +46,9 @@ export interface ModelCatalog extends ModelChoiceState {
46
46
  /** Models left out because a provider/model ID contains a known credential
47
47
  * literal or control characters; never their identifiers. */
48
48
  withheld: number;
49
+ /** The saved preference that the next Send would install, read only and
50
+ * offered only when it names a selectable entry of this catalog. */
51
+ remembered: ModelSelector | null;
49
52
  }
50
53
  export interface ChooseModelRequest {
51
54
  expected: ChoiceVersion;
@@ -120,6 +123,19 @@ export function decodeModelCandidate(value: unknown): ModelCandidate {
120
123
  invalid();
121
124
  return candidate;
122
125
  }
126
+ /** Whether a catalog offers this exact selector as a selectable choice. */
127
+ export function catalogOffers(
128
+ entries: readonly ModelCandidate[],
129
+ selector: ModelSelector,
130
+ ): boolean {
131
+ return entries.some(
132
+ (e) =>
133
+ e.provider === selector.provider &&
134
+ e.model === selector.model &&
135
+ e.api === selector.api &&
136
+ e.thinking.some((t) => t.selectable && t.level === selector.thinking),
137
+ );
138
+ }
123
139
  export function decodeModelCatalog(value: unknown): ModelCatalog {
124
140
  canonicalJson({ kind: "ok", value }, LIMITS.pageBytes);
125
141
  const o = closed(value, [
@@ -128,15 +144,18 @@ export function decodeModelCatalog(value: unknown): ModelCatalog {
128
144
  "status",
129
145
  "entries",
130
146
  "withheld",
147
+ "remembered",
131
148
  ]);
132
149
  const entries = list(o.entries, LIMITS.maxPageEntries, decodeModelCandidate);
150
+ const remembered = nullable(o.remembered, decodeModelSelector);
133
151
  const status = oneOf(o.status, ["complete", "capacity"]);
134
152
  const withheld = integer(o.withheld, 0, LIMITS.maxPageEntries);
135
153
  if (
136
154
  (status === "capacity" && (entries.length || withheld)) ||
137
155
  entries.length + withheld > LIMITS.maxPageEntries ||
138
156
  new Set(entries.map((e) => canonicalJson([e.provider, e.model]))).size !==
139
- entries.length
157
+ entries.length ||
158
+ (remembered && !catalogOffers(entries, remembered))
140
159
  )
141
160
  invalid();
142
161
  return {
@@ -145,5 +164,6 @@ export function decodeModelCatalog(value: unknown): ModelCatalog {
145
164
  status,
146
165
  entries,
147
166
  withheld,
167
+ remembered,
148
168
  };
149
169
  }
@@ -234,6 +234,7 @@ export {
234
234
  export {
235
235
  type ChoiceVersion,
236
236
  type ChooseModelRequest,
237
+ catalogOffers,
237
238
  decodeChoiceVersion,
238
239
  decodeChooseModelRequest,
239
240
  decodeModelCandidate,
@@ -3611,6 +3611,9 @@ function decodeModelCandidate(value) {
3611
3611
  invalid();
3612
3612
  return candidate;
3613
3613
  }
3614
+ function catalogOffers(entries, selector) {
3615
+ return entries.some((e) => e.provider === selector.provider && e.model === selector.model && e.api === selector.api && e.thinking.some((t) => t.selectable && t.level === selector.thinking));
3616
+ }
3614
3617
  function decodeModelCatalog(value) {
3615
3618
  canonicalJson({ kind: "ok", value }, LIMITS.pageBytes);
3616
3619
  const o = closed(value, [
@@ -3618,19 +3621,22 @@ function decodeModelCatalog(value) {
3618
3621
  "selected",
3619
3622
  "status",
3620
3623
  "entries",
3621
- "withheld"
3624
+ "withheld",
3625
+ "remembered"
3622
3626
  ]);
3623
3627
  const entries = list(o.entries, LIMITS.maxPageEntries, decodeModelCandidate);
3628
+ const remembered = nullable(o.remembered, decodeModelSelector);
3624
3629
  const status = oneOf(o.status, ["complete", "capacity"]);
3625
3630
  const withheld = integer(o.withheld, 0, LIMITS.maxPageEntries);
3626
- if (status === "capacity" && (entries.length || withheld) || entries.length + withheld > LIMITS.maxPageEntries || new Set(entries.map((e) => canonicalJson([e.provider, e.model]))).size !== entries.length)
3631
+ if (status === "capacity" && (entries.length || withheld) || entries.length + withheld > LIMITS.maxPageEntries || new Set(entries.map((e) => canonicalJson([e.provider, e.model]))).size !== entries.length || remembered && !catalogOffers(entries, remembered))
3627
3632
  invalid();
3628
3633
  return {
3629
3634
  version: decodeChoiceVersion(o.version),
3630
3635
  selected: nullable(o.selected, decodeModelSelection),
3631
3636
  status,
3632
3637
  entries,
3633
- withheld
3638
+ withheld,
3639
+ remembered
3634
3640
  };
3635
3641
  }
3636
3642
  // src/service/contracts/workflow.ts
@@ -9884,7 +9890,7 @@ async function createGateway(value, hostUrl, source) {
9884
9890
  const input = decodeGatewayInput(value), store = new GatewayStore(input.serverConfig, input.stateHome);
9885
9891
  const web = loadWebAssets(source?.webDirectory);
9886
9892
  const build2 = {
9887
- contractHash: "663f71a44cd33f95377644cfc10c2cb657298f191b36d6ca05b810e849c54e68",
9893
+ contractHash: "b6935a8daa09f70de094136c18d8e3588fdd34fc24b9a8fe95e465de11ddae8d",
9888
9894
  assets: {
9889
9895
  sourceHash: web.manifest.sourceHash,
9890
9896
  contractHash: web.manifest.contractHash,
@@ -22569,7 +22575,15 @@ class OwnerModelChoice {
22569
22575
  this.options.models.assertCurrent(before.selected);
22570
22576
  if (canonicalJson(before) !== canonicalJson(this.snapshot()))
22571
22577
  throw new ContractError("stale");
22572
- return decodeModelCatalog({ ...before, ...catalog });
22578
+ let remembered = null;
22579
+ try {
22580
+ const saved = this.options.recall?.() ?? null;
22581
+ if (saved && catalogOffers(catalog.entries, saved))
22582
+ remembered = saved;
22583
+ } catch {
22584
+ remembered = null;
22585
+ }
22586
+ return decodeModelCatalog({ ...before, ...catalog, remembered });
22573
22587
  }
22574
22588
  choose(value) {
22575
22589
  const request3 = decodeChooseModelRequest(value);
@@ -26189,8 +26203,8 @@ class WorkflowHistoryScanner {
26189
26203
 
26190
26204
  // src/service/workflows.ts
26191
26205
  var OWNER_RUNTIME = Object.freeze({
26192
- version: "2.0.26",
26193
- build: "0d1a59a981d4065126bc6199f28b7343fcf7b86e51db3569e06176be5fd52960",
26206
+ version: "2.0.27",
26207
+ build: "8ef1833b9806c52b446f2864252a2cd50eb71fef901da32dcd35aee988c4775c",
26194
26208
  entry: fileURLToPath5(import.meta.url),
26195
26209
  pid: process.pid,
26196
26210
  node: process.versions.node,
@@ -27968,7 +27982,7 @@ var processLifetime = {
27968
27982
  }
27969
27983
  };
27970
27984
  async function createServiceHost(value, sourceBuild, lifetime) {
27971
- const embedded = "663f71a44cd33f95377644cfc10c2cb657298f191b36d6ca05b810e849c54e68";
27985
+ const embedded = "b6935a8daa09f70de094136c18d8e3588fdd34fc24b9a8fe95e465de11ddae8d";
27972
27986
  if (embedded && sourceBuild)
27973
27987
  throw new ContractError("unsupported-context");
27974
27988
  const contractHash = decodeHash(embedded ?? sourceBuild?.contractHash);
@@ -28126,7 +28140,8 @@ async function createServiceHost(value, sourceBuild, lifetime) {
28126
28140
  owner,
28127
28141
  models,
28128
28142
  access,
28129
- remember: (value2) => preferences.save(value2)
28143
+ remember: (value2) => preferences.save(value2),
28144
+ recall: () => preferences.read()
28130
28145
  });
28131
28146
  const { PI_OFFLINE: _offline, ...ordinary } = launch;
28132
28147
  const checkEnvironment = Object.freeze(ordinary);