@abelxiaoxing/cadence 2.0.33 → 2.0.34

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.
@@ -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";
@@ -93,6 +93,7 @@ export const ERROR_CODES = [
93
93
  "expired-grant",
94
94
  "consumed-grant",
95
95
  "unsupported-context",
96
+ "retired-conversation",
96
97
  "quarantine",
97
98
  "capacity",
98
99
  "unavailable",
@@ -138,6 +139,7 @@ export function errorStatus(code) {
138
139
  case "expired-grant":
139
140
  return 410;
140
141
  case "unsupported-context":
142
+ case "retired-conversation":
141
143
  return 422;
142
144
  case "quarantine":
143
145
  return 423;
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"