@uluops/ops-sdk 6.1.0 → 6.4.1

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +93 -1
  2. package/README.md +231 -2
  3. package/dist/client.d.ts +155 -81
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +141 -67
  6. package/dist/client.js.map +1 -1
  7. package/dist/config/constants.d.ts +3 -1
  8. package/dist/config/constants.d.ts.map +1 -1
  9. package/dist/config/constants.js +2 -0
  10. package/dist/config/constants.js.map +1 -1
  11. package/dist/config/generated-version.d.ts +1 -1
  12. package/dist/config/generated-version.js +1 -1
  13. package/dist/config/index.d.ts +1 -0
  14. package/dist/config/index.d.ts.map +1 -1
  15. package/dist/config/index.js +1 -0
  16. package/dist/config/index.js.map +1 -1
  17. package/dist/config/validators.d.ts +25 -1
  18. package/dist/config/validators.d.ts.map +1 -1
  19. package/dist/config/validators.js +31 -1
  20. package/dist/config/validators.js.map +1 -1
  21. package/dist/config/workspace-org.d.ts +77 -0
  22. package/dist/config/workspace-org.d.ts.map +1 -0
  23. package/dist/config/workspace-org.js +182 -0
  24. package/dist/config/workspace-org.js.map +1 -0
  25. package/dist/errors/errors.d.ts +118 -0
  26. package/dist/errors/errors.d.ts.map +1 -1
  27. package/dist/errors/errors.js +138 -0
  28. package/dist/errors/errors.js.map +1 -1
  29. package/dist/http/http-client.d.ts +46 -0
  30. package/dist/http/http-client.d.ts.map +1 -1
  31. package/dist/http/http-client.js +88 -5
  32. package/dist/http/http-client.js.map +1 -1
  33. package/dist/index.d.ts +2 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/operations/admin.d.ts +100 -0
  38. package/dist/operations/admin.d.ts.map +1 -0
  39. package/dist/operations/admin.js +130 -0
  40. package/dist/operations/admin.js.map +1 -0
  41. package/dist/operations/auth.d.ts +21 -1
  42. package/dist/operations/auth.d.ts.map +1 -1
  43. package/dist/operations/auth.js +49 -3
  44. package/dist/operations/auth.js.map +1 -1
  45. package/dist/operations/orgs.d.ts +27 -0
  46. package/dist/operations/orgs.d.ts.map +1 -0
  47. package/dist/operations/orgs.js +34 -0
  48. package/dist/operations/orgs.js.map +1 -0
  49. package/dist/operations/projects.d.ts +46 -0
  50. package/dist/operations/projects.d.ts.map +1 -1
  51. package/dist/operations/projects.js +54 -1
  52. package/dist/operations/projects.js.map +1 -1
  53. package/dist/types/auth.d.ts +10 -0
  54. package/dist/types/auth.d.ts.map +1 -1
  55. package/dist/types/index.d.ts +2 -0
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/index.js +2 -0
  58. package/dist/types/index.js.map +1 -1
  59. package/dist/types/org.d.ts +25 -0
  60. package/dist/types/org.d.ts.map +1 -0
  61. package/dist/types/org.js +2 -0
  62. package/dist/types/org.js.map +1 -0
  63. package/dist/types/rehome.d.ts +234 -0
  64. package/dist/types/rehome.d.ts.map +1 -0
  65. package/dist/types/rehome.js +171 -0
  66. package/dist/types/rehome.js.map +1 -0
  67. package/dist/types/response-schemas.d.ts +19 -0
  68. package/dist/types/response-schemas.d.ts.map +1 -1
  69. package/dist/types/response-schemas.js +19 -0
  70. package/dist/types/response-schemas.js.map +1 -1
  71. package/dist/types/schemas.d.ts +20 -0
  72. package/dist/types/schemas.d.ts.map +1 -1
  73. package/dist/types/schemas.js +22 -0
  74. package/dist/types/schemas.js.map +1 -1
  75. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/config/validators.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,EAC3B,mCAAmC,EACnC,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,yBAAy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EAAE,sBAAsB,EAAE;SACvE,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc,EAAE,SAAiB;IACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,oBAAoB,CAAC,GAAG,SAAS,cAAc,EAAE;YACzD,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE;SAC9D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc,EAAE,SAAiB;IACnE,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,oBAAoB,CAAC,GAAG,SAAS,6BAA6B,EAAE;YACxE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE;SAC7E,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,77 @@
1
+ /** The workspace file name, found by walking upward from cwd. */
2
+ export declare const WORKSPACE_ORG_FILE = ".uluops.json";
3
+ /** Reserved `org` value: stop the walk here and use the personal org. */
4
+ export declare const PERSONAL_ORG_SENTINEL = "personal";
5
+ export type WorkspaceOrgSource = 'explicit' | 'workspace' | 'env' | 'personal';
6
+ export interface WorkspaceOrgResolution {
7
+ /** The org slug to send, or `undefined` for the personal org (no header). */
8
+ org: string | undefined;
9
+ /** Which rung answered. `'personal'` also covers a workspace file that says `"personal"`. */
10
+ source: WorkspaceOrgSource;
11
+ /** The workspace file that answered, when `source` is `'workspace'` or a `"personal"` stop. */
12
+ path?: string;
13
+ }
14
+ export interface ResolveWorkspaceOrgOptions {
15
+ /** A per-call / per-invocation value; wins over everything when set. */
16
+ explicit?: string;
17
+ /** Directory to walk upward from. Defaults to `process.cwd()`. */
18
+ cwd?: string;
19
+ /** Environment to read `ULUOPS_ORG_SLUG` from. Defaults to `process.env`. */
20
+ env?: NodeJS.ProcessEnv;
21
+ /**
22
+ * Directory at which the walk stops (inclusive). Defaults to the running
23
+ * user's home directory when `cwd` is under it (a file at `/` or `/Users`
24
+ * can never answer), else the filesystem root. Tests pass a temp dir so a
25
+ * real `.uluops.json` above it cannot leak in.
26
+ */
27
+ stopAt?: string;
28
+ /** Home directory used for the default `stopAt`. Defaults to `os.homedir()`. Injectable for tests. */
29
+ home?: string;
30
+ /**
31
+ * Numeric uid the answering file must be owned by. Defaults to
32
+ * `process.getuid()`; `undefined` on platforms without uids (Windows)
33
+ * disables the check. Injectable for tests (chown is not available to them).
34
+ */
35
+ uid?: number;
36
+ }
37
+ /**
38
+ * Find the nearest `.uluops.json` at or above `cwd`, stopping at `stopAt`.
39
+ * With no `stopAt`, the walk is bounded by `home` (default `os.homedir()`)
40
+ * when `cwd` is under it: security audit run #187 (all four agents) — an
41
+ * unbounded walk makes a file at `/`, `/Users` or a container image root
42
+ * the silent default for every checkout beneath it, which is the
43
+ * single-default leak D13 exists to remove, one layer down. Outside the
44
+ * home directory the walk still reaches the filesystem root; the ownership
45
+ * check in `readWorkspaceOrgFile` is the guard there.
46
+ */
47
+ export declare function findWorkspaceOrgFile(cwd: string, stopAt?: string, home?: string): string | undefined;
48
+ /**
49
+ * Read one workspace file. Returns the `org` it declares (`"personal"` is
50
+ * returned verbatim — the caller decides what it means), or `undefined` when
51
+ * the file exists but declares no `org`.
52
+ *
53
+ * A file not owned by `uid` (default: the running user) is REFUSED, not
54
+ * skipped: a shared parent directory another user can write to is the
55
+ * planting vector (run #187, circumvention A2), and a silently skipped file
56
+ * is a silently wrong org. Pass `uid: undefined` explicitly only on
57
+ * platforms with no uids.
58
+ *
59
+ * @throws {InputValidationError} on unreadable JSON, a non-object body, a
60
+ * key other than `org`/`$schema`, a file owned by another user, or an
61
+ * `org` that is not a valid slug (other than the sentinel).
62
+ */
63
+ export declare function readWorkspaceOrgFile(path: string, uid?: number | undefined): string | undefined;
64
+ /**
65
+ * Resolve the org for a call: explicit > nearest workspace file > env > personal.
66
+ *
67
+ * Never returns the sentinel — a `"personal"` file yields `{ org: undefined,
68
+ * source: 'personal', path }`. Never consults a cache; the walk is a handful
69
+ * of `existsSync` calls and a resolver that remembered would reintroduce the
70
+ * process-level default the spec rejects.
71
+ *
72
+ * @throws {InputValidationError} for an invalid `explicit` slug, or a
73
+ * malformed / forbidden workspace file (loud on purpose: a silently ignored
74
+ * file is a silently wrong org).
75
+ */
76
+ export declare function resolveWorkspaceOrg(options?: ResolveWorkspaceOrgOptions): WorkspaceOrgResolution;
77
+ //# sourceMappingURL=workspace-org.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-org.d.ts","sourceRoot":"","sources":["../../src/config/workspace-org.ts"],"names":[],"mappings":"AAuCA,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAehD,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,6FAA6F;IAC7F,MAAM,EAAE,kBAAkB,CAAC;IAC3B,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sGAAsG;IACtG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,MAAkB,GAAG,MAAM,GAAG,SAAS,CAY/G;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,GAAG,SAA8B,GAAG,MAAM,GAAG,SAAS,CA8CnH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA+B,GAAG,sBAAsB,CAwBpG"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Workspace org resolution — D13 of the project-org-routing-and-rehome spec.
3
+ *
4
+ * "Where you are" decides which org a tracker call lands in. The unit that
5
+ * distinguishes personal work from work-org work on one machine is the
6
+ * CHECKOUT, not the process or the person: an env var or a profile leaks the
7
+ * last-set org into whatever repo is opened next (spec §2.0 S3/S7). So the
8
+ * default comes from a file in the tree, found by walking upward from `cwd`
9
+ * to the nearest `.uluops.json` — the way `.npmrc` and `.gitignore` are found.
10
+ *
11
+ * Precedence, highest first:
12
+ * 1. `explicit` — a per-call / per-invocation value (`--org`, an MCP tool's
13
+ * `org` argument);
14
+ * 2. the nearest `.uluops.json` above `cwd` whose `org` is set — including
15
+ * the reserved value `"personal"`, which STOPS the walk and
16
+ * resolves to no org (a personal repo cloned under a work
17
+ * tree carries it so the outer file does not win);
18
+ * 3. `ULUOPS_ORG_SLUG` in `env` — kept as the lowest fall-through for
19
+ * headless environments with no checkout;
20
+ * 4. undefined — no header; the API key holder's personal org.
21
+ *
22
+ * The file may carry ONLY `org`. Credentials, base URLs and profiles are
23
+ * refused, not ignored: a `.env` in cwd once retargeted the CLI's base URL,
24
+ * and the one thing that keeps that footgun from transferring is that this
25
+ * file cannot name a target or an identity. An org slug is server-relative —
26
+ * the same file against a different base URL names a different org or none —
27
+ * so callers that print "where it landed" should print the base URL beside
28
+ * the org.
29
+ *
30
+ * Runtime-agnostic: reads are synchronous `fs` calls, no `process.cwd()` is
31
+ * consulted unless the caller passes none, and `env` is injectable so tests
32
+ * never touch the real environment.
33
+ */
34
+ import { existsSync, readFileSync, statSync } from 'fs';
35
+ import { homedir } from 'os';
36
+ import { dirname, join, resolve, relative, isAbsolute } from 'path';
37
+ import { InputValidationError } from './validators.js';
38
+ import { ENV_VARS } from './constants.js';
39
+ /** The workspace file name, found by walking upward from cwd. */
40
+ export const WORKSPACE_ORG_FILE = '.uluops.json';
41
+ /** Reserved `org` value: stop the walk here and use the personal org. */
42
+ export const PERSONAL_ORG_SENTINEL = 'personal';
43
+ /** Same pattern as `OpsHttpClient`'s `orgSlug` — it is a header value. */
44
+ const ORG_SLUG_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,99}$/;
45
+ /**
46
+ * The ONLY keys a workspace file may carry. An allowlist, not a denylist:
47
+ * until 6.3.1 this was a list of ten forbidden names while the error message
48
+ * said "may carry only org" — `baseURL`, `apikey`, `token` and anything
49
+ * unlisted passed (security audit run #187, agentic-security-analyst F10).
50
+ * Inert then (only `org` was ever read), but the stated invariant must be
51
+ * the enforced one. `$schema` is allowed for editor tooling.
52
+ */
53
+ const ALLOWED_KEYS = new Set(['org', '$schema']);
54
+ function assertSlug(value, where) {
55
+ if (typeof value !== 'string' || !ORG_SLUG_PATTERN.test(value)) {
56
+ throw new InputValidationError(`Invalid org in ${where}: must be 1-100 alphanumeric characters, hyphens, or underscores`, [{ code: 'custom', path: ['org'], message: 'must be 1-100 alphanumeric characters, hyphens, or underscores' }]);
57
+ }
58
+ return value;
59
+ }
60
+ /** True when `child` is `parent` or lies beneath it. */
61
+ function isUnder(child, parent) {
62
+ const rel = relative(parent, child);
63
+ return rel === '' || (!rel.startsWith('..') && !isAbsolute(rel));
64
+ }
65
+ /**
66
+ * Find the nearest `.uluops.json` at or above `cwd`, stopping at `stopAt`.
67
+ * With no `stopAt`, the walk is bounded by `home` (default `os.homedir()`)
68
+ * when `cwd` is under it: security audit run #187 (all four agents) — an
69
+ * unbounded walk makes a file at `/`, `/Users` or a container image root
70
+ * the silent default for every checkout beneath it, which is the
71
+ * single-default leak D13 exists to remove, one layer down. Outside the
72
+ * home directory the walk still reaches the filesystem root; the ownership
73
+ * check in `readWorkspaceOrgFile` is the guard there.
74
+ */
75
+ export function findWorkspaceOrgFile(cwd, stopAt, home = homedir()) {
76
+ let dir = resolve(cwd);
77
+ const homeAbs = resolve(home);
78
+ const stop = stopAt !== undefined ? resolve(stopAt) : isUnder(dir, homeAbs) ? homeAbs : undefined;
79
+ for (;;) {
80
+ const candidate = join(dir, WORKSPACE_ORG_FILE);
81
+ if (existsSync(candidate))
82
+ return candidate;
83
+ if (stop !== undefined && dir === stop)
84
+ return undefined;
85
+ const parent = dirname(dir);
86
+ if (parent === dir)
87
+ return undefined;
88
+ dir = parent;
89
+ }
90
+ }
91
+ /**
92
+ * Read one workspace file. Returns the `org` it declares (`"personal"` is
93
+ * returned verbatim — the caller decides what it means), or `undefined` when
94
+ * the file exists but declares no `org`.
95
+ *
96
+ * A file not owned by `uid` (default: the running user) is REFUSED, not
97
+ * skipped: a shared parent directory another user can write to is the
98
+ * planting vector (run #187, circumvention A2), and a silently skipped file
99
+ * is a silently wrong org. Pass `uid: undefined` explicitly only on
100
+ * platforms with no uids.
101
+ *
102
+ * @throws {InputValidationError} on unreadable JSON, a non-object body, a
103
+ * key other than `org`/`$schema`, a file owned by another user, or an
104
+ * `org` that is not a valid slug (other than the sentinel).
105
+ */
106
+ export function readWorkspaceOrgFile(path, uid = process.getuid?.()) {
107
+ if (uid !== undefined) {
108
+ let ownerUid;
109
+ try {
110
+ ownerUid = statSync(path).uid;
111
+ }
112
+ catch (err) {
113
+ throw new InputValidationError(`Unreadable ${WORKSPACE_ORG_FILE} at ${path}: ${err instanceof Error ? err.message : String(err)}`, [{ code: 'custom', path: [], message: 'cannot stat' }]);
114
+ }
115
+ if (ownerUid !== uid) {
116
+ throw new InputValidationError(`Refusing ${WORKSPACE_ORG_FILE} at ${path}: owned by uid ${String(ownerUid)}, not you (uid ${String(uid)}). ` +
117
+ 'A workspace file decides which org your writes land in; only your own may answer.', [{ code: 'custom', path: [], message: 'not owned by the running user' }]);
118
+ }
119
+ }
120
+ let parsed;
121
+ try {
122
+ parsed = JSON.parse(readFileSync(path, 'utf8'));
123
+ }
124
+ catch (err) {
125
+ throw new InputValidationError(`Unreadable ${WORKSPACE_ORG_FILE} at ${path}: ${err instanceof Error ? err.message : String(err)}`, [{ code: 'custom', path: [], message: 'invalid JSON' }]);
126
+ }
127
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
128
+ throw new InputValidationError(`Invalid ${WORKSPACE_ORG_FILE} at ${path}: expected an object`, [{ code: 'custom', path: [], message: 'expected an object' }]);
129
+ }
130
+ const body = parsed;
131
+ const forbidden = Object.keys(body).filter((k) => !ALLOWED_KEYS.has(k));
132
+ if (forbidden.length > 0) {
133
+ throw new InputValidationError(`Refusing ${WORKSPACE_ORG_FILE} at ${path}: it may carry only "org"; found ${forbidden.map((k) => `"${k}"`).join(', ')}. ` +
134
+ 'Credentials and targets belong in ~/.uluops/credentials.json or the environment, never in the checkout.', forbidden.map((k) => ({ code: 'custom', path: [k], message: 'forbidden in the workspace file' })));
135
+ }
136
+ if (!('org' in body) || body['org'] === undefined || body['org'] === null)
137
+ return undefined;
138
+ if (body['org'] === PERSONAL_ORG_SENTINEL)
139
+ return PERSONAL_ORG_SENTINEL;
140
+ return assertSlug(body['org'], `${WORKSPACE_ORG_FILE} at ${path}`);
141
+ }
142
+ /**
143
+ * Resolve the org for a call: explicit > nearest workspace file > env > personal.
144
+ *
145
+ * Never returns the sentinel — a `"personal"` file yields `{ org: undefined,
146
+ * source: 'personal', path }`. Never consults a cache; the walk is a handful
147
+ * of `existsSync` calls and a resolver that remembered would reintroduce the
148
+ * process-level default the spec rejects.
149
+ *
150
+ * @throws {InputValidationError} for an invalid `explicit` slug, or a
151
+ * malformed / forbidden workspace file (loud on purpose: a silently ignored
152
+ * file is a silently wrong org).
153
+ */
154
+ export function resolveWorkspaceOrg(options = {}) {
155
+ if (options.explicit !== undefined) {
156
+ // The sentinel is honoured on the explicit path too (6.3.1, run #187
157
+ // circumvention A3): a caller told "omit org for your personal org" will
158
+ // sometimes write `org: personal`, and until now that went to the wire
159
+ // as a slug (404, or a real org if anyone registers the name).
160
+ if (options.explicit === PERSONAL_ORG_SENTINEL)
161
+ return { org: undefined, source: 'explicit' };
162
+ return { org: assertSlug(options.explicit, 'explicit org'), source: 'explicit' };
163
+ }
164
+ const cwd = options.cwd ?? process.cwd();
165
+ const path = findWorkspaceOrgFile(cwd, options.stopAt, options.home);
166
+ if (path !== undefined) {
167
+ const declared = readWorkspaceOrgFile(path, 'uid' in options ? options.uid : process.getuid?.());
168
+ if (declared === PERSONAL_ORG_SENTINEL)
169
+ return { org: undefined, source: 'personal', path };
170
+ if (declared !== undefined)
171
+ return { org: declared, source: 'workspace', path };
172
+ // A file with no `org` is not an answer; keep walking would be surprising
173
+ // ("the nearest file wins" is the rule), so fall through to env.
174
+ }
175
+ const env = options.env ?? process.env;
176
+ const fromEnv = env[ENV_VARS.ORG_SLUG];
177
+ if (fromEnv !== undefined && fromEnv !== '') {
178
+ return { org: assertSlug(fromEnv, `env ${ENV_VARS.ORG_SLUG}`), source: 'env' };
179
+ }
180
+ return { org: undefined, source: 'personal' };
181
+ }
182
+ //# sourceMappingURL=workspace-org.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-org.js","source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OAAO,EAAE,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACjF,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAChD,CAAC"}
@@ -53,4 +53,122 @@ export declare class AnalysisEchoMismatchError extends Error {
53
53
  analysisWrite: unknown;
54
54
  });
55
55
  }
56
+ import { SdkApiError as _SdkApiError } from '@uluops/sdk-core/errors';
57
+ /**
58
+ * 403 — the caller is a member of the org but below the write floor
59
+ * (`publisher`). On tracker writes the API rewrites the body: `details.applied`
60
+ * is `false` and the message forbids retrying without `org`. DO NOT retry the
61
+ * same call without an org: an org-less retry does not "fall back", it files
62
+ * the work in the caller's PERSONAL org (spec §3.1, S6).
63
+ */
64
+ export declare const INSUFFICIENT_ORG_ROLE: "INSUFFICIENT_ORG_ROLE";
65
+ /** 403 — the caller is not a member of the org named by `org` / `orgSlug`, or the key is bound to a different org. */
66
+ export declare const ORG_ACCESS_DENIED: "ORG_ACCESS_DENIED";
67
+ /**
68
+ * 410 — the project this name once denoted in this org has been RE-HOMED to
69
+ * another org (spec D14). `details.target_org.slug` is where it lives now:
70
+ * pass it as `org` and the same call succeeds. Do not create a new project
71
+ * at the old address — the tombstone exists precisely to refuse that fork.
72
+ */
73
+ export declare const PROJECT_REHOMED: "PROJECT_REHOMED";
74
+ /** `details` on an `INSUFFICIENT_ORG_ROLE` rejection from a tracker write. */
75
+ export interface InsufficientOrgRoleDetails {
76
+ currentRole?: string;
77
+ requiredRole?: string;
78
+ /** Present on tracker writes: the org the write was refused in. */
79
+ orgSlug?: string | null;
80
+ /** Present on tracker writes: always `false` — nothing was applied. */
81
+ applied?: boolean;
82
+ }
83
+ /** `details` on a `PROJECT_REHOMED` rejection (spec §4.4a). */
84
+ export interface ProjectRehomedDetails {
85
+ project_id: string;
86
+ target_org: {
87
+ id: string;
88
+ slug: string;
89
+ };
90
+ rehomed_at?: string;
91
+ reason?: string | null;
92
+ }
93
+ /** Type guard: the org write floor refused this call (403 `INSUFFICIENT_ORG_ROLE`). Terminal — do not retry without `org`. */
94
+ export declare function isInsufficientOrgRoleError(err: unknown): err is _SdkApiError & {
95
+ details?: InsufficientOrgRoleDetails;
96
+ };
97
+ /** Type guard: not a member of the named org, or the key is bound elsewhere (403 `ORG_ACCESS_DENIED`). Terminal. */
98
+ export declare function isOrgAccessDeniedError(err: unknown): err is _SdkApiError;
99
+ /** Type guard: the project was re-homed; `err.details.target_org.slug` is the org to pass (410 `PROJECT_REHOMED`). */
100
+ export declare function isProjectRehomedError(err: unknown): err is _SdkApiError & {
101
+ details: ProjectRehomedDetails;
102
+ };
103
+ /**
104
+ * 403 — the route is session-only (D20): platform-admin writes that mint or
105
+ * re-point identity, and the two cross-tenant project moves, refuse a `ulr_`
106
+ * key even when its user is a platform admin. Terminal for a key-authenticated
107
+ * client: log in (`OpsClient.login`, completing MFA with `loginWithTotp` if
108
+ * challenged) and retry with the session — never by minting another key.
109
+ */
110
+ export declare const SESSION_REQUIRED: "SESSION_REQUIRED";
111
+ /** 403 — the caller lacks the PLATFORM role (`users.role`) the admin path requires; distinct from the org-role codes above. */
112
+ export declare const INSUFFICIENT_ROLE: "INSUFFICIENT_ROLE";
113
+ /** Type guard: session-only route refused an API key (403 `SESSION_REQUIRED`). Terminal for key auth. */
114
+ export declare function isSessionRequiredError(err: unknown): err is _SdkApiError;
115
+ /** Type guard: the caller's PLATFORM role is below what the admin path requires (403 `INSUFFICIENT_ROLE`). Terminal — no org argument changes it. */
116
+ export declare function isInsufficientRoleError(err: unknown): err is _SdkApiError;
117
+ /**
118
+ * The refusal reasons a re-home can answer with, as `details.reason` on a
119
+ * 400 (`VALIDATION_ERROR`) or 409 (`CONFLICT`). Enumerated here because the
120
+ * Phase 4 runbook (spec §4.7 item 3) assigns each a disposition, and a script
121
+ * that switches on a string it typed itself will misspell one:
122
+ *
123
+ * - `same_org` — already there. Idempotent re-run over a finished row; count as done.
124
+ * - `moved_during_request` / `deadlock_retry` / `concurrent_modification` — re-read and retry once.
125
+ * - `name_collision` / `soft_deleted_conflict` / `rehomed_away_conflict` — skip and report.
126
+ * - `export_in_progress` — an export job holds either org; wait, then retry.
127
+ * - `project_soft_deleted` / `project_has_no_org` — the source row is not movable as-is; stop and look.
128
+ */
129
+ export declare const REHOME_REFUSAL_REASONS: readonly ["same_org", "moved_during_request", "deadlock_retry", "concurrent_modification", "name_collision", "soft_deleted_conflict", "rehomed_away_conflict", "export_in_progress", "project_soft_deleted", "project_has_no_org"];
130
+ export type RehomeRefusalReason = (typeof REHOME_REFUSAL_REASONS)[number];
131
+ /**
132
+ * The re-home refusal reason carried by a rejection, or `null` when the error
133
+ * is not one of the enumerated re-home refusals (a 403 org code, a 402
134
+ * `PROJECT_LIMIT`, a network failure). Reads `details.reason`; an unknown
135
+ * reason string returns null rather than a widened type — a new server reason
136
+ * should reach the caller as "not one I know", not as a silently-handled case.
137
+ *
138
+ * `null` therefore means "not a re-home refusal I can name", NOT "safe to
139
+ * retry": a `TimeoutError` / `NetworkError` after the server committed the
140
+ * move also reads `null`, and a blind retry on the admin path answers
141
+ * `same_org` (fine) while on the member path it answers 404 (see
142
+ * `projects.rehome`). Branch on `isTimeoutError` / `isNetworkError` first.
143
+ */
144
+ export declare function rehomeRefusalReason(err: unknown): RehomeRefusalReason | null;
145
+ /**
146
+ * Thrown by `OpsClient.login` / `auth.login` when the account has MFA enabled:
147
+ * the API answers `200 { mfa_required: true, mfa_challenge_token, ... }` and no
148
+ * session. Until 6.4.0 this surfaced as a raw `ZodError` on `sessionToken`,
149
+ * which made the SDK unable to log in ANY MFA account. Complete the login with
150
+ * `OpsClient.loginWithTotp(err.mfaChallengeToken, code)` before the challenge
151
+ * expires (`expiresAt`). WebAuthn completion is not offered by this SDK.
152
+ *
153
+ * **The token is single-use and is consumed before the code is verified** —
154
+ * a mistyped code burns it; do not loop on `loginWithTotp` with the same
155
+ * token, call `login()` again for a new challenge. And this error is raised
156
+ * only by `login()` / `auth.login()`: a client constructed with
157
+ * `{ email, password }` (or autoloaded credentials) logs in inside sdk-core,
158
+ * which cannot see the challenge and surfaces a generic `UnauthorizedError`
159
+ * — MFA accounts must use the two-step `login()` → `loginWithTotp()` path.
160
+ */
161
+ export declare class MfaRequiredError extends Error {
162
+ readonly name = "MfaRequiredError";
163
+ readonly mfaChallengeToken: string;
164
+ readonly expiresAt: string;
165
+ readonly mfaMethods: readonly string[];
166
+ constructor(challenge: {
167
+ mfaChallengeToken: string;
168
+ expiresAt: string;
169
+ mfaMethods: readonly string[];
170
+ });
171
+ }
172
+ /** Type guard for {@link MfaRequiredError}. */
173
+ export declare function isMfaRequiredError(err: unknown): err is MfaRequiredError;
56
174
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,WAAW,IAAI,WAAW,EAC1B,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,IAAI,aAAa,EAC9B,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG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E3B,SAAS,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE;CASvG;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gBAAgB,CAExE"}
@@ -56,4 +56,142 @@ export class AnalysisEchoMismatchError extends Error {
56
56
  this.analysisWrite = details.analysisWrite;
57
57
  }
58
58
  }
59
+ // ---------------------------------------------------------------------------
60
+ // Org routing (project-org-routing-and-rehome spec, 6.2.0)
61
+ // ---------------------------------------------------------------------------
62
+ import { SdkApiError as _SdkApiError } from '@uluops/sdk-core/errors';
63
+ /**
64
+ * 403 — the caller is a member of the org but below the write floor
65
+ * (`publisher`). On tracker writes the API rewrites the body: `details.applied`
66
+ * is `false` and the message forbids retrying without `org`. DO NOT retry the
67
+ * same call without an org: an org-less retry does not "fall back", it files
68
+ * the work in the caller's PERSONAL org (spec §3.1, S6).
69
+ */
70
+ export const INSUFFICIENT_ORG_ROLE = 'INSUFFICIENT_ORG_ROLE';
71
+ /** 403 — the caller is not a member of the org named by `org` / `orgSlug`, or the key is bound to a different org. */
72
+ export const ORG_ACCESS_DENIED = 'ORG_ACCESS_DENIED';
73
+ /**
74
+ * 410 — the project this name once denoted in this org has been RE-HOMED to
75
+ * another org (spec D14). `details.target_org.slug` is where it lives now:
76
+ * pass it as `org` and the same call succeeds. Do not create a new project
77
+ * at the old address — the tombstone exists precisely to refuse that fork.
78
+ */
79
+ export const PROJECT_REHOMED = 'PROJECT_REHOMED';
80
+ function hasCode(err, code) {
81
+ return err instanceof _SdkApiError && err.code === code;
82
+ }
83
+ /** Type guard: the org write floor refused this call (403 `INSUFFICIENT_ORG_ROLE`). Terminal — do not retry without `org`. */
84
+ export function isInsufficientOrgRoleError(err) {
85
+ return hasCode(err, INSUFFICIENT_ORG_ROLE);
86
+ }
87
+ /** Type guard: not a member of the named org, or the key is bound elsewhere (403 `ORG_ACCESS_DENIED`). Terminal. */
88
+ export function isOrgAccessDeniedError(err) {
89
+ return hasCode(err, ORG_ACCESS_DENIED);
90
+ }
91
+ /** Type guard: the project was re-homed; `err.details.target_org.slug` is the org to pass (410 `PROJECT_REHOMED`). */
92
+ export function isProjectRehomedError(err) {
93
+ if (!hasCode(err, PROJECT_REHOMED))
94
+ return false;
95
+ const d = err.details;
96
+ return typeof d?.target_org?.slug === 'string' && typeof d.project_id === 'string';
97
+ }
98
+ // ---------------------------------------------------------------------------
99
+ // Re-home surfaces (spec §4, 6.4.0)
100
+ // ---------------------------------------------------------------------------
101
+ /**
102
+ * 403 — the route is session-only (D20): platform-admin writes that mint or
103
+ * re-point identity, and the two cross-tenant project moves, refuse a `ulr_`
104
+ * key even when its user is a platform admin. Terminal for a key-authenticated
105
+ * client: log in (`OpsClient.login`, completing MFA with `loginWithTotp` if
106
+ * challenged) and retry with the session — never by minting another key.
107
+ */
108
+ export const SESSION_REQUIRED = 'SESSION_REQUIRED';
109
+ /** 403 — the caller lacks the PLATFORM role (`users.role`) the admin path requires; distinct from the org-role codes above. */
110
+ export const INSUFFICIENT_ROLE = 'INSUFFICIENT_ROLE';
111
+ /** Type guard: session-only route refused an API key (403 `SESSION_REQUIRED`). Terminal for key auth. */
112
+ export function isSessionRequiredError(err) {
113
+ return hasCode(err, SESSION_REQUIRED);
114
+ }
115
+ /** Type guard: the caller's PLATFORM role is below what the admin path requires (403 `INSUFFICIENT_ROLE`). Terminal — no org argument changes it. */
116
+ export function isInsufficientRoleError(err) {
117
+ return hasCode(err, INSUFFICIENT_ROLE);
118
+ }
119
+ /**
120
+ * The refusal reasons a re-home can answer with, as `details.reason` on a
121
+ * 400 (`VALIDATION_ERROR`) or 409 (`CONFLICT`). Enumerated here because the
122
+ * Phase 4 runbook (spec §4.7 item 3) assigns each a disposition, and a script
123
+ * that switches on a string it typed itself will misspell one:
124
+ *
125
+ * - `same_org` — already there. Idempotent re-run over a finished row; count as done.
126
+ * - `moved_during_request` / `deadlock_retry` / `concurrent_modification` — re-read and retry once.
127
+ * - `name_collision` / `soft_deleted_conflict` / `rehomed_away_conflict` — skip and report.
128
+ * - `export_in_progress` — an export job holds either org; wait, then retry.
129
+ * - `project_soft_deleted` / `project_has_no_org` — the source row is not movable as-is; stop and look.
130
+ */
131
+ export const REHOME_REFUSAL_REASONS = [
132
+ 'same_org',
133
+ 'moved_during_request',
134
+ 'deadlock_retry',
135
+ 'concurrent_modification',
136
+ 'name_collision',
137
+ 'soft_deleted_conflict',
138
+ 'rehomed_away_conflict',
139
+ 'export_in_progress',
140
+ 'project_soft_deleted',
141
+ 'project_has_no_org',
142
+ ];
143
+ /**
144
+ * The re-home refusal reason carried by a rejection, or `null` when the error
145
+ * is not one of the enumerated re-home refusals (a 403 org code, a 402
146
+ * `PROJECT_LIMIT`, a network failure). Reads `details.reason`; an unknown
147
+ * reason string returns null rather than a widened type — a new server reason
148
+ * should reach the caller as "not one I know", not as a silently-handled case.
149
+ *
150
+ * `null` therefore means "not a re-home refusal I can name", NOT "safe to
151
+ * retry": a `TimeoutError` / `NetworkError` after the server committed the
152
+ * move also reads `null`, and a blind retry on the admin path answers
153
+ * `same_org` (fine) while on the member path it answers 404 (see
154
+ * `projects.rehome`). Branch on `isTimeoutError` / `isNetworkError` first.
155
+ */
156
+ export function rehomeRefusalReason(err) {
157
+ if (!(err instanceof _SdkApiError))
158
+ return null;
159
+ const reason = err.details?.reason;
160
+ return typeof reason === 'string' && REHOME_REFUSAL_REASONS.includes(reason)
161
+ ? reason
162
+ : null;
163
+ }
164
+ /**
165
+ * Thrown by `OpsClient.login` / `auth.login` when the account has MFA enabled:
166
+ * the API answers `200 { mfa_required: true, mfa_challenge_token, ... }` and no
167
+ * session. Until 6.4.0 this surfaced as a raw `ZodError` on `sessionToken`,
168
+ * which made the SDK unable to log in ANY MFA account. Complete the login with
169
+ * `OpsClient.loginWithTotp(err.mfaChallengeToken, code)` before the challenge
170
+ * expires (`expiresAt`). WebAuthn completion is not offered by this SDK.
171
+ *
172
+ * **The token is single-use and is consumed before the code is verified** —
173
+ * a mistyped code burns it; do not loop on `loginWithTotp` with the same
174
+ * token, call `login()` again for a new challenge. And this error is raised
175
+ * only by `login()` / `auth.login()`: a client constructed with
176
+ * `{ email, password }` (or autoloaded credentials) logs in inside sdk-core,
177
+ * which cannot see the challenge and surfaces a generic `UnauthorizedError`
178
+ * — MFA accounts must use the two-step `login()` → `loginWithTotp()` path.
179
+ */
180
+ export class MfaRequiredError extends Error {
181
+ name = 'MfaRequiredError';
182
+ mfaChallengeToken;
183
+ expiresAt;
184
+ mfaMethods;
185
+ constructor(challenge) {
186
+ super(`Login requires a second factor (${challenge.mfaMethods.join(', ') || 'unknown method'}); ` +
187
+ 'complete it with loginWithTotp(mfaChallengeToken, code) before the challenge expires');
188
+ this.mfaChallengeToken = challenge.mfaChallengeToken;
189
+ this.expiresAt = challenge.expiresAt;
190
+ this.mfaMethods = challenge.mfaMethods;
191
+ }
192
+ }
193
+ /** Type guard for {@link MfaRequiredError}. */
194
+ export function isMfaRequiredError(err) {
195
+ return err instanceof MfaRequiredError;
196
+ }
59
197
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,WAAW,IAAI,WAAW,EAC1B,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,IAAI,aAAa,EAC9B,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,cAAc,GACf,MAAM,yBAAyB,CAAC;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