@signetai/core 0.154.4 → 0.154.7

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.
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Canonical Signet workspace path resolution.
3
+ *
4
+ * One owner for the "resolve `SIGNET_PATH` → `SIGNET_WORKSPACE` →
5
+ * `$XDG_CONFIG_HOME/signet/workspace.json` → `~/.agents` default" chain that
6
+ * is shared by connector-base, the CLI, and the desktop shell (issue #956).
7
+ *
8
+ * Resolution precedence:
9
+ * 1. `SIGNET_PATH` env var
10
+ * 2. `SIGNET_WORKSPACE` env var (alias, lower precedence)
11
+ * 3. persisted `$XDG_CONFIG_HOME/signet/workspace.json` `{ workspace }`
12
+ * 4. `~/.agents` default
13
+ *
14
+ * Env var precedence is defined once here and applied everywhere, so a synced
15
+ * or cloned agents directory resolves consistently regardless of which surface
16
+ * performs the resolution.
17
+ */
18
+ export type WorkspaceSource = "env" | "config" | "default";
19
+ export interface WorkspaceResolution {
20
+ readonly path: string;
21
+ readonly source: WorkspaceSource;
22
+ readonly configPath: string;
23
+ readonly configuredPath: string | null;
24
+ }
25
+ export interface ResolveWorkspacePathOptions {
26
+ readonly env?: NodeJS.ProcessEnv;
27
+ readonly home?: string;
28
+ /**
29
+ * Throw on a malformed persisted workspace.json instead of falling back to
30
+ * the default. Default `false` (graceful), which is required for surfaces
31
+ * that resolve at import time and must never crash on a corrupt config.
32
+ * Explicit install operations pass `true` to fail loud.
33
+ */
34
+ readonly strict?: boolean;
35
+ /**
36
+ * Require an env-derived workspace path to point at an existing directory.
37
+ * When `false` (default) an env override is trusted verbatim. When `true`,
38
+ * a stale env override is treated as unset (with a warning) and resolution
39
+ * falls through to the config/default, which prevents a migrated/legacy
40
+ * managed extension from re-embedding a path that no longer exists
41
+ * (issue #1016).
42
+ */
43
+ readonly requireExistingEnvPath?: boolean;
44
+ }
45
+ /** Env vars honored as workspace overrides, in precedence order. */
46
+ export declare const WORKSPACE_ENV_KEYS: readonly ["SIGNET_PATH", "SIGNET_WORKSPACE"];
47
+ export declare function normalizeWorkspacePath(pathValue: string, home?: string): string;
48
+ export declare function getWorkspaceConfigPath(env?: NodeJS.ProcessEnv, home?: string): string;
49
+ /**
50
+ * Read the persisted `workspace` value from `workspace.json`.
51
+ *
52
+ * Returns `null` when the file is absent or (in non-strict mode) malformed.
53
+ * In strict mode a malformed file throws, preserving the historical contract
54
+ * of explicit install operations.
55
+ */
56
+ export declare function readConfiguredWorkspacePath(env?: NodeJS.ProcessEnv, home?: string, options?: {
57
+ readonly strict?: boolean;
58
+ }): string | null;
59
+ export declare function writeConfiguredWorkspacePath(pathValue: string, env?: NodeJS.ProcessEnv, home?: string): string;
60
+ export declare function clearConfiguredWorkspacePath(env?: NodeJS.ProcessEnv): void;
61
+ /**
62
+ * Resolve the active Signet workspace path from env, persisted config, and
63
+ * default, returning a structured result describing which source won.
64
+ */
65
+ export declare function resolveWorkspacePath(options?: ResolveWorkspacePathOptions): WorkspaceResolution;
66
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC1C;AAYD,oEAAoE;AACpE,eAAO,MAAM,kBAAkB,8CAA+C,CAAC;AAQ/E,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,SAAY,GAAG,MAAM,CAElF;AAgCD,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,EAAE,IAAI,SAAY,GAAG,MAAM,CAErG;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAC1C,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,SAAY,EAChB,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACzC,MAAM,GAAG,IAAI,CA6Bf;AAED,wBAAgB,4BAA4B,CAC3C,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,SAAY,GACd,MAAM,CAaR;AAED,wBAAgB,4BAA4B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,IAAI,CAIvF;AAMD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,2BAAgC,GAAG,mBAAmB,CAuCnG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/core",
3
- "version": "0.154.4",
3
+ "version": "0.154.7",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Core library for Signet - portable AI agent identity",
6
6
  "type": "module",