@abelxiaoxing/cadence 2.0.40 → 2.0.41

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.
@@ -226,11 +226,12 @@ This discovers neither idle terminals nor other accounts/hosts, and does not pro
226
226
  ## Investigating installed packages
227
227
 
228
228
  Cadence research, diagnosis and review remain readonly, but their search roots are defaults rather than a barrier around the checkout.
229
- Use `read`, `ls`, `grep` and `find`/`glob` with an explicit host path to inspect an installed package; `~` refers to the service account's home.
230
- Searches include dependency directories and follow symlinks with cycle detection.
231
- `grep` supports regular expressions by default and `literal: true` for exact text; `find`/`glob` support patterns such as `**/*.{ts,js}`.
232
- For deep package trees, set `depth` explicitly.
233
- A result with `nextCursor` is a continuing observation, not a failed search or evidence of absence.
229
+ Use Pi's standard `read`, `ls`, `grep` and `find` with an explicit host path to inspect an installed package; `~` refers to the service account's home.
230
+ Searches follow Pi's `.gitignore` behavior; inspect ignored dependencies and backups with explicit file paths and directory listings rather than treating no matches as proof that they do not exist.
231
+ `grep` accepts one regular expression by default, or `literal: true` for exact text; `find` accepts glob patterns such as `**/*.ts`.
232
+ Read one file at a time with `offset` and `limit`, following the next-offset notice for remaining text.
233
+ For truncated searches or listings, follow the tool's limit notice or narrow the query; ordinary file tools have no `depth`, batch or cursor parameters.
234
+ Searches use already available `rg` and `fd`/`fdfind` binaries or Pi's existing tool cache; missing tools are reported without automatically downloading or installing them.
234
235
 
235
236
  Readonly subagents do not have shell or editing tools: use the direct listing, search and read tools rather than a `bash` pipeline.
236
237
  Approved implementation workers keep their existing shell and editing tools.
@@ -109,3 +109,17 @@ There is no automatic retry of `npm publish`, version bump, unpublish, dist-tag
109
109
  After a failed or interrupted publish, inspect npm before retrying: the registry may have accepted the request despite a lost client reply.
110
110
  Confirmation makes bounded readonly observations for propagation and does not convert a failed publish command into a successful command receipt.
111
111
  The live-ref/latest checks are not a transaction with other maintainers; an external publication can still race and must be investigated rather than overwritten.
112
+
113
+ ### Delayed or unconfirmed publication
114
+
115
+ npm can accept `npm publish` and then process the package asynchronously before its version, `latest` and tarball become publicly visible.
116
+ The confirmation helper uses one monotonic observation deadline for metadata requests, body reads and polling delays; its total window, interval and unchanged per-request ceiling live beside the constants in `scripts/npm-release.mjs`.
117
+ Candidate-version or tarball 404s and a lagging `latest` are retried with readonly requests only.
118
+ Digest, identity, tarball URL, streamed-byte mismatches and a newer `latest` refuse immediately; other HTTP, transport and malformed-response failures are not treated as propagation.
119
+ Each request is limited by the remaining total time, aborted on expiry and awaited through settlement; successful or failed reads dispose their timers.
120
+
121
+ The confirmation step records the original publish-step outcome separately in its failure log and job summary.
122
+ A successful publish followed by an observation timeout means **publication is still unconfirmed**, not that the publish command failed or the version is safe to reuse.
123
+ Keep that run's original audited artifact and digest, then independently recheck registry metadata, `latest` and downloaded bytes against that same artifact.
124
+ Do not rerun the publish job or workflow, replay `npm publish`, move/delete its tag, or repair registry state automatically.
125
+ A later matching readonly observation can confirm publication, but does not rewrite the earlier run's failed outcome; confirmation also cannot turn an originally failed publish command into a successful receipt.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abelxiaoxing/cadence",
3
- "version": "2.0.40",
3
+ "version": "2.0.41",
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",
@@ -58,7 +58,6 @@
58
58
  "src/git-environment.mjs",
59
59
  "src/git-environment.d.mts",
60
60
  "src/research-tools.mjs",
61
- "src/research-scan.mjs",
62
61
  "src/worker-toolkit.mjs",
63
62
  "src/worker-workspace.mjs",
64
63
  "src/worker-workspace.d.mts",
@@ -5,6 +5,27 @@ import { randomUUID } from "node:crypto";
5
5
  import { Type } from "typebox";
6
6
  import { gitArguments, gitEnvironment } from "./git-environment.mjs";
7
7
 
8
+ // Only fixed-revision evidence retains a cursor protocol. Inactive fields have
9
+ // a legal wire value even if a provider requires every declared property.
10
+ const optional = (schema) =>
11
+ Type.Optional({
12
+ ...schema,
13
+ type: [schema.type, "null"],
14
+ ...(schema.enum ? { enum: [...schema.enum, null] } : {}),
15
+ });
16
+
17
+ const parameters = Type.Object(
18
+ {
19
+ mode: optional(
20
+ Type.String({ enum: ["paths", "diff", "base", "candidate"] }),
21
+ ),
22
+ path: optional(Type.String({ maxLength: 1024 })),
23
+ cursor: optional(Type.String({ maxLength: 128 })),
24
+ close: optional(Type.Boolean({ enum: [true] })),
25
+ },
26
+ { additionalProperties: false },
27
+ );
28
+
8
29
  export const CHANGE_LIMITS = Object.freeze({
9
30
  scans: 4,
10
31
  pageBytes: 2048,
@@ -42,15 +63,29 @@ export function createChangeTools(binding) {
42
63
  const execute = async (_id, args, signal) => {
43
64
  if (closing) throw new Error("Change observations closed");
44
65
  if (signal?.aborted) throw new Error("Change observation canceled");
45
- if (!args || typeof args !== "object" || Array.isArray(args))
46
- throw new Error("Invalid change arguments");
66
+ if (
67
+ !args ||
68
+ typeof args !== "object" ||
69
+ Array.isArray(args) ||
70
+ Object.keys(args).some(
71
+ (key) => !Object.hasOwn(parameters.properties, key),
72
+ )
73
+ )
74
+ throw new Error(
75
+ "Invalid change arguments: use only declared fields; omit unused fields or set them to null",
76
+ );
77
+ args = Object.fromEntries(
78
+ Object.entries(args).filter(([, value]) => value !== null),
79
+ );
47
80
  let scan;
48
81
  if (args.cursor !== undefined) {
49
82
  if (
50
83
  Object.keys(args).some((k) => !["cursor", "close"].includes(k)) ||
51
84
  (args.close !== undefined && args.close !== true)
52
85
  )
53
- throw new Error("A change cursor cannot change its query");
86
+ throw new Error(
87
+ "A change cursor request accepts only cursor and optional close:true; omit mode/path or set them to null. For a new query, omit cursor/close or set them to null",
88
+ );
54
89
  scan = cursors.get(args.cursor);
55
90
  if (!scan)
56
91
  throw new Error(
@@ -59,8 +94,10 @@ export function createChangeTools(binding) {
59
94
  cursors.delete(args.cursor);
60
95
  clearTimeout(scan.timer);
61
96
  } else {
62
- if (Object.keys(args).some((k) => !["mode", "path"].includes(k)))
63
- throw new Error("Invalid change arguments");
97
+ if (args.close !== undefined)
98
+ throw new Error(
99
+ "Invalid change arguments: close:true requires a returned cursor; omit close and cursor or set them to null for a new query",
100
+ );
64
101
  const mode = args.mode ?? "paths",
65
102
  path = args.path;
66
103
  if (!["paths", "diff", "base", "candidate"].includes(mode))
@@ -233,18 +270,9 @@ export function createChangeTools(binding) {
233
270
  name: "changes",
234
271
  label: "changes",
235
272
  description:
236
- "Readonly evidence for the owner's fixed base/candidate commits. mode paths lists changed paths (Git-quoted), diff reads patches, base/candidate reads one file at that revision. Optional checkout-relative path narrows a diff. Text may split across pages: continue exclusively with {cursor}; {cursor,close:true} releases it. more is incomplete, including empty progress. No arbitrary refs, Git commands, shell or writes.",
237
- parameters: Type.Object(
238
- {
239
- mode: Type.Optional(
240
- Type.String({ enum: ["paths", "diff", "base", "candidate"] }),
241
- ),
242
- path: Type.Optional(Type.String({ maxLength: 1024 })),
243
- cursor: Type.Optional(Type.String({ maxLength: 128 })),
244
- close: Type.Optional(Type.Literal(true)),
245
- },
246
- { additionalProperties: false },
247
- ),
273
+ "Readonly evidence for the owner's fixed base/candidate commits. mode paths lists changed paths (Git-quoted), diff reads patches, base/candidate reads one file at that revision. Optional checkout-relative path narrows a diff. Text may split across pages: continue exclusively with {cursor}; {cursor,close:true} releases it. more is incomplete, including empty progress. No arbitrary refs, Git commands, shell or writes. Omit unused parameters or set them to null; never invent a cursor or mix query and cursor fields.",
274
+ parameters,
275
+ constrainedSampling: { type: "json_schema", strict: "prefer" },
248
276
  execute,
249
277
  },
250
278
  ],