@abelxiaoxing/cadence 2.0.33 → 2.0.35
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.md +3 -0
- package/docs/conversation-mode.md +27 -4
- package/docs/history.md +7 -3
- package/docs/service-management.md +23 -9
- package/package.json +3 -1
- package/src/cadence-instructions.ts +1 -0
- package/src/cadence-mode.ts +70 -35
- package/src/conversation-identity.ts +7 -0
- package/src/image-content.mjs +120 -0
- package/src/native-build.ts +1 -1
- package/src/sdk-worker.mjs +85 -1
- package/src/service/contracts/core.ts +1 -0
- package/src/service/contracts/models.ts +53 -0
- package/src/service/contracts/workbench.ts +308 -59
- package/src/service/contracts/workflow.ts +16 -1
- package/src/service-cli.mjs +25 -6
- package/src/service-client.ts +55 -9
- package/src/service-host.mjs +23637 -22485
- package/src/session-entries.mjs +3 -0
- package/src/worker-public.mjs +8 -1
- package/src/workspace.ts +16 -0
- package/web/dist/assets/cadence.css +1 -1
- package/web/dist/assets/cadence.js +19 -17
- package/web/dist/manifest.json +7 -7
package/src/session-entries.mjs
CHANGED
|
@@ -5,3 +5,6 @@
|
|
|
5
5
|
export const CADENCE_MODE_ENTRY = "cadence-conversation-mode/1";
|
|
6
6
|
/** Marks a session the browser created; Pi ignores it in the model context. */
|
|
7
7
|
export const WEBUI_SESSION_ENTRY = "cadence-webui/1";
|
|
8
|
+
|
|
9
|
+
/** Browser command/user identity and finalized message boundary, not model context. */
|
|
10
|
+
export const BROWSER_COMMAND_ENTRY = "cadence-browser-command/1";
|
package/src/worker-public.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Public types live solely in worker-public.d.mts; the TS contract paths are re-export shims.
|
|
3
3
|
* Initially relocated mechanically from W1 core/domain/capture; not a generated build output. */
|
|
4
4
|
/** Portable service boundary. No SDK objects, credentials, filesystem paths as IDs, or execution owner. */
|
|
5
|
+
export const IMAGE_COUNT = 4;
|
|
5
6
|
export const SERVICE_PROTOCOL = 1;
|
|
6
7
|
export const WORKER_PROTOCOL = 2;
|
|
7
8
|
export const GRAPH_SCHEMA = "cadence-graph/2";
|
|
@@ -93,6 +94,7 @@ export const ERROR_CODES = [
|
|
|
93
94
|
"expired-grant",
|
|
94
95
|
"consumed-grant",
|
|
95
96
|
"unsupported-context",
|
|
97
|
+
"retired-conversation",
|
|
96
98
|
"quarantine",
|
|
97
99
|
"capacity",
|
|
98
100
|
"unavailable",
|
|
@@ -138,6 +140,7 @@ export function errorStatus(code) {
|
|
|
138
140
|
case "expired-grant":
|
|
139
141
|
return 410;
|
|
140
142
|
case "unsupported-context":
|
|
143
|
+
case "retired-conversation":
|
|
141
144
|
return 422;
|
|
142
145
|
case "quarantine":
|
|
143
146
|
return 423;
|
|
@@ -935,6 +938,7 @@ export function decodeWorkerPublicRequest(v) {
|
|
|
935
938
|
"context",
|
|
936
939
|
"instructions",
|
|
937
940
|
"prompt",
|
|
941
|
+
...(Object.hasOwn(v ?? {}, "imageCount") ? ["imageCount"] : []),
|
|
938
942
|
"handoff",
|
|
939
943
|
]);
|
|
940
944
|
const result = {
|
|
@@ -949,7 +953,10 @@ export function decodeWorkerPublicRequest(v) {
|
|
|
949
953
|
role: role(o.role),
|
|
950
954
|
context: text(o.context, 32768),
|
|
951
955
|
instructions: text(o.instructions, LIMITS.instructionsBytes, true),
|
|
952
|
-
prompt: text(o.prompt, 32768,
|
|
956
|
+
prompt: text(o.prompt, 32768, o.imageCount === undefined),
|
|
957
|
+
...(o.imageCount === undefined
|
|
958
|
+
? {}
|
|
959
|
+
: { imageCount: integer(o.imageCount, 1, IMAGE_COUNT) }),
|
|
953
960
|
handoff: decodeHandoff(o.handoff),
|
|
954
961
|
};
|
|
955
962
|
if (result.handoff.inputs.some((i) => i.assignmentId !== result.assignmentId))
|
package/src/workspace.ts
CHANGED
|
@@ -212,6 +212,22 @@ export function resolveWorkspace(cwd: string): { root: string; cwd: string } {
|
|
|
212
212
|
throw new Error("Git workspace lookup refused");
|
|
213
213
|
return { root: actual, cwd: actual };
|
|
214
214
|
}
|
|
215
|
+
/** Lexical membership only: retained contexts can outlive their directory. */
|
|
216
|
+
export function withinWorkspace(root: string, cwd: string): boolean {
|
|
217
|
+
const path = relative(root, cwd);
|
|
218
|
+
return !isAbsolute(path) && path !== ".." && !path.startsWith(`..${sep}`);
|
|
219
|
+
}
|
|
220
|
+
/** The owner is the checkout, not a saved conversation/default directory. A
|
|
221
|
+
* provably removed default may remain metadata while other directories work.
|
|
222
|
+
* Unreadable or foreign defaults are not classified as absent. */
|
|
223
|
+
export function ownerDefaultInCheckout(root: string, cwd: string): boolean {
|
|
224
|
+
try {
|
|
225
|
+
return resolveWorkspace(cwd).root === root;
|
|
226
|
+
} catch (error) {
|
|
227
|
+
if (!absent(error)) throw error;
|
|
228
|
+
return withinWorkspace(root, canonicalAmbientRoot(cwd));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
215
231
|
export function defaultStateHome(): string {
|
|
216
232
|
const candidate =
|
|
217
233
|
process.platform === "win32"
|