@noodleseed/one 0.159.0 → 0.161.0

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 (54) hide show
  1. package/dist/commands/deploy-first-flow.d.ts +1 -1
  2. package/dist/commands/deploy-first-flow.d.ts.map +1 -1
  3. package/dist/commands/deploy-first-flow.js +4 -193
  4. package/dist/commands/deploy-first-flow.js.map +1 -1
  5. package/dist/commands/deploy-ops.d.ts.map +1 -1
  6. package/dist/commands/deploy-ops.js +25 -1
  7. package/dist/commands/deploy-ops.js.map +1 -1
  8. package/dist/commands/deploy-preflight-command.d.ts +8 -0
  9. package/dist/commands/deploy-preflight-command.d.ts.map +1 -0
  10. package/dist/commands/deploy-preflight-command.js +78 -0
  11. package/dist/commands/deploy-preflight-command.js.map +1 -0
  12. package/dist/commands/deploy-preflight-output.d.ts +18 -0
  13. package/dist/commands/deploy-preflight-output.d.ts.map +1 -0
  14. package/dist/commands/deploy-preflight-output.js +176 -0
  15. package/dist/commands/deploy-preflight-output.js.map +1 -0
  16. package/dist/commands/deploy-preflight.d.ts +6 -1
  17. package/dist/commands/deploy-preflight.d.ts.map +1 -1
  18. package/dist/commands/deploy-preflight.js +24 -0
  19. package/dist/commands/deploy-preflight.js.map +1 -1
  20. package/dist/commands/deploy-target.d.ts +1 -0
  21. package/dist/commands/deploy-target.d.ts.map +1 -1
  22. package/dist/commands/deploy-target.js +9 -8
  23. package/dist/commands/deploy-target.js.map +1 -1
  24. package/dist/plugin-mode/build-readiness-recorder.d.ts.map +1 -1
  25. package/dist/plugin-mode/build-readiness-recorder.js +3 -0
  26. package/dist/plugin-mode/build-readiness-recorder.js.map +1 -1
  27. package/dist/plugin-mode/plugin-operation-contract.d.ts +120 -1
  28. package/dist/plugin-mode/plugin-operation-contract.d.ts.map +1 -1
  29. package/dist/plugin-mode/plugin-operation-contract.js +32 -1
  30. package/dist/plugin-mode/plugin-operation-contract.js.map +1 -1
  31. package/dist/plugin-mode/plugin-operation-tools.d.ts.map +1 -1
  32. package/dist/plugin-mode/plugin-operation-tools.js +47 -2
  33. package/dist/plugin-mode/plugin-operation-tools.js.map +1 -1
  34. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +1 -1
  35. package/node_modules/@noodle-borg/agent-kit/dist/plugin-bootstrap-skill.js +1 -1
  36. package/node_modules/@noodle-borg/agent-kit/dist/skill-operations-refs.js +2 -1
  37. package/node_modules/@noodle-borg/agent-kit/dist/skill-router.js +1 -1
  38. package/node_modules/@noodle-borg/agent-kit/dist/skill-verification-ref.js +1 -0
  39. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  40. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-hosted-deployment.js +85 -68
  41. package/node_modules/@noodle-borg/control-plane/dist/contracts.d.ts +5 -0
  42. package/node_modules/@noodle-borg/control-plane/dist/contracts.js +9 -0
  43. package/node_modules/@noodle-borg/control-plane/dist/in-memory-control-plane-store.d.ts +16 -1
  44. package/node_modules/@noodle-borg/control-plane/dist/in-memory-control-plane-store.js +18 -0
  45. package/node_modules/@noodle-borg/control-plane/dist/portable.d.ts +1 -0
  46. package/node_modules/@noodle-borg/control-plane/dist/portable.js +1 -0
  47. package/node_modules/@noodle-borg/runtime/dist/managed-origins.d.ts +6 -1
  48. package/node_modules/@noodle-borg/runtime/dist/managed-origins.js +4 -0
  49. package/node_modules/@noodle-borg/service/dist/registry-compile.js +21 -12
  50. package/node_modules/@noodle-borg/service/dist/registry-deploy-transaction.js +14 -10
  51. package/node_modules/@noodle-borg/service/dist/routes/deploy-preflight.js +9 -7
  52. package/node_modules/@noodle-borg/service/dist/routes/org-admin.js +21 -11
  53. package/node_modules/@noodle-borg/service/package.json +1 -1
  54. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import { PersonalWorkspaceOwnerMutationError } from './contracts.js';
1
2
  import { InMemoryOrganizationStore } from './in-memory-organization-store.js';
2
3
  import { personalOrgSlugSuffix } from './organization-helpers.js';
3
4
  import { validateUserOwnedOrgSlug } from './validation.js';
@@ -75,6 +76,18 @@ export class InMemoryControlPlaneStore extends InMemoryOrganizationStore {
75
76
  return org;
76
77
  });
77
78
  }
79
+ addOrgMember(input) {
80
+ this.#assertPersonalOwnerMutation(input.org, input.subject, input.role);
81
+ return super.addOrgMember(input);
82
+ }
83
+ removeOrgMember(input) {
84
+ this.#assertPersonalOwnerMutation(input.org, input.subject);
85
+ return super.removeOrgMember(input);
86
+ }
87
+ updateOrgMemberRole(input) {
88
+ this.#assertPersonalOwnerMutation(input.org, input.subject, input.role);
89
+ return super.updateOrgMemberRole(input);
90
+ }
78
91
  claimWelcomeEmail(input) {
79
92
  const nowMs = input.now.getTime();
80
93
  const record = [...this.#welcomeEmails.values()]
@@ -131,6 +144,11 @@ export class InMemoryControlPlaneStore extends InMemoryOrganizationStore {
131
144
  role: 'owner',
132
145
  });
133
146
  }
147
+ #assertPersonalOwnerMutation(org, subject, role) {
148
+ if (this.#personalWorkspaces.get(subject) === org && role !== 'owner') {
149
+ throw new PersonalWorkspaceOwnerMutationError();
150
+ }
151
+ }
134
152
  async #serialized(key, operation) {
135
153
  const prior = this.#queues.get(key) ?? Promise.resolve();
136
154
  let release;
@@ -1,5 +1,6 @@
1
1
  export { type AppPurgeReconciliationActor, type AppPurgeReconciliationConflictCode, AppPurgeReconciliationError, type AppPurgeReconciliationOperator, } from './app-purge-reconciliation-port.js';
2
2
  export type { ActiveMcpSubdomainClaim, ChangeMcpSubdomainInput, ControlPlaneIdentity, CreateOrgWithOwnerInput, McpSubdomainMutationResult, McpSubdomainSetting, OrganizationStore, OrgDomainRecord, OrgInvitationRecord, OrgMemberRecord, OrgOpenAIAppsChallengeRecord, OrgRecord, OrgRole, PersonalWorkspaceProvisionInput, PersonalWorkspaceProvisionResult, SignupAllowlistKind, SignupAllowlistRecord, WelcomeEmailRecord, } from './contracts.js';
3
+ export { PersonalWorkspaceOwnerMutationError } from './contracts.js';
3
4
  export { allowAllGate, bearerToken, type ControlPlaneAuthResult, type DeployAuthGate, } from './deploy-auth.js';
4
5
  export { CompositeControlPlaneGate, type ControlPlaneSignupMode, GoogleControlPlaneGate, type GoogleControlPlaneGateOptions, type GoogleIdTokenVerifier, GoogleWorkloadControlPlaneGate, type GoogleWorkloadControlPlaneGateOptions, NoodleOAuthControlPlaneGate, type NoodleOAuthControlPlaneGateOptions, type SignupAuthorizer, } from './deploy-gates.js';
5
6
  export { InMemoryControlPlaneStore } from './in-memory-control-plane-store.js';
@@ -1,4 +1,5 @@
1
1
  export { AppPurgeReconciliationError, } from './app-purge-reconciliation-port.js';
2
+ export { PersonalWorkspaceOwnerMutationError } from './contracts.js';
2
3
  export { allowAllGate, bearerToken, } from './deploy-auth.js';
3
4
  export { CompositeControlPlaneGate, GoogleControlPlaneGate, GoogleWorkloadControlPlaneGate, NoodleOAuthControlPlaneGate, } from './deploy-gates.js';
4
5
  export { InMemoryControlPlaneStore } from './in-memory-control-plane-store.js';
@@ -1,11 +1,16 @@
1
1
  import type { CompileError, RuntimeArtifact } from '@noodle-borg/compiler';
2
+ interface ManagedOriginError extends CompileError {
3
+ readonly variableName: string;
4
+ readonly reason: 'missing' | 'invalid';
5
+ }
2
6
  export type ManagedOriginResolutionResult = {
3
7
  readonly ok: true;
4
8
  readonly artifact: RuntimeArtifact;
5
9
  } | {
6
10
  readonly ok: false;
7
- readonly errors: readonly CompileError[];
11
+ readonly errors: readonly ManagedOriginError[];
8
12
  };
9
13
  /** Bind operator-owned exact origins into every runtime authority and host projection. */
10
14
  export declare function resolveManagedOrigins(artifact: RuntimeArtifact, variables: Readonly<Record<string, string>>): ManagedOriginResolutionResult;
15
+ export {};
11
16
  //# sourceMappingURL=managed-origins.d.ts.map
@@ -53,6 +53,8 @@ function resolveManagedOrigin(value, variables, path, allowLoopback, replacement
53
53
  if (resolved === undefined) {
54
54
  errors.push({
55
55
  code: 'invalid_shape',
56
+ variableName: match[1],
57
+ reason: 'missing',
56
58
  path,
57
59
  message: `managed origin variable "${match[1]}" is not configured`,
58
60
  });
@@ -61,6 +63,8 @@ function resolveManagedOrigin(value, variables, path, allowLoopback, replacement
61
63
  if (!isCanonicalOrigin(resolved, allowLoopback)) {
62
64
  errors.push({
63
65
  code: 'invalid_shape',
66
+ variableName: match[1],
67
+ reason: 'invalid',
64
68
  path,
65
69
  message: allowLoopback
66
70
  ? `managed origin variable "${match[1]}" must resolve to a canonical bare HTTPS origin (loopback HTTP is allowed for development)`
@@ -45,14 +45,10 @@ export async function compileRegistryTarget(context, input) {
45
45
  : { localDevtoolsCustomerIdentity: true }),
46
46
  })
47
47
  : [];
48
- if (identityErrors.length > 0)
49
- return { ok: false, errors: identityErrors };
50
48
  // A delegated-auth tool on a pure public surface inevitably fails; reject it while the author can fix it.
51
49
  const projectionErrors = compiled.ok
52
50
  ? publicSurfaceDelegatedAuthErrors(compiled.artifact, secretBindings)
53
51
  : [];
54
- if (projectionErrors.length > 0)
55
- return { ok: false, errors: projectionErrors };
56
52
  const [resolvedSecrets, resolvedVariables] = await Promise.all([
57
53
  context.configStore.resolveConfigValues('secret', scope),
58
54
  context.configStore.resolveConfigValues('variable', scope),
@@ -65,13 +61,20 @@ export async function compileRegistryTarget(context, input) {
65
61
  return { ok: false, errors: [...connectorConfigErrors, ...compiled.errors] };
66
62
  }
67
63
  const missingServerConfig = missingServerConfigErrors(compiled.artifact, resolvedSecrets, resolvedVariables);
68
- const configErrors = [...connectorConfigErrors, ...missingServerConfig];
69
- if (configErrors.length > 0)
70
- return { ok: false, errors: configErrors };
64
+ const errors = [
65
+ ...identityErrors,
66
+ ...projectionErrors,
67
+ ...connectorConfigErrors,
68
+ ...missingServerConfig,
69
+ ];
71
70
  const originResolution = resolveManagedOrigins(compiled.artifact, resolvedVariables);
72
- if (!originResolution.ok)
73
- return { ok: false, errors: originResolution.errors };
74
- const artifact = originResolution.artifact;
71
+ if (!originResolution.ok) {
72
+ const missingVariables = new Set(errors.filter((error) => error.code === 'missing_variable').map((error) => error.path));
73
+ errors.push(...originResolution.errors
74
+ // An unset binding is already actionable config, not an independent invalid-origin fault.
75
+ .filter((error) => error.reason !== 'missing' || !missingVariables.has(`variables.${error.variableName}`))
76
+ .map(({ code, path, message }) => ({ code, path, message })));
77
+ }
75
78
  let appPackageSnapshot;
76
79
  if (input.renderAppPackage && compiled.appPackage !== undefined) {
77
80
  try {
@@ -79,11 +82,17 @@ export async function compileRegistryTarget(context, input) {
79
82
  }
80
83
  catch (error) {
81
84
  if (error instanceof AppPackageSnapshotError) {
82
- return { ok: false, errors: [error.deployError] };
85
+ errors.push(error.deployError);
86
+ }
87
+ else {
88
+ throw error;
83
89
  }
84
- throw error;
85
90
  }
86
91
  }
92
+ if (errors.length > 0 || !originResolution.ok) {
93
+ return { ok: false, errors, compiledArtifact: compiled.artifact };
94
+ }
95
+ const artifact = originResolution.artifact;
87
96
  const localAuthority = context.delegatedExchange === undefined &&
88
97
  secretBindings.some((binding) => binding.authKind === 'delegatedTokenExchange')
89
98
  ? await context.localDevtoolsDelegatedExchange?.resolve()
@@ -10,20 +10,24 @@ export async function preflightRegistryDeploy(input) {
10
10
  return deployerRequiredError(accessMode);
11
11
  }
12
12
  const built = await input.compile();
13
- if (!built.ok)
14
- return built;
15
- const missingCapabilities = missingCapabilityErrors(built.served.artifact.requirements?.capabilities ?? [], input.serviceCapabilities);
16
- if (missingCapabilities.length > 0)
17
- return { ok: false, errors: missingCapabilities };
18
- if (accessMode === 'customers' && built.served.artifact.server.auth === undefined) {
19
- return serverAuthRequiredError();
13
+ const errors = built.ok ? [] : [...built.errors];
14
+ const artifact = built.ok ? built.served.artifact : built.compiledArtifact;
15
+ if (artifact !== undefined) {
16
+ errors.push(...missingCapabilityErrors(artifact.requirements?.capabilities ?? [], input.serviceCapabilities));
17
+ if (accessMode === 'customers' && artifact.server.auth === undefined) {
18
+ errors.push(...serverAuthRequiredError().errors);
19
+ }
20
20
  }
21
21
  if (orgMembershipSources !== undefined) {
22
22
  if (orgMembershipSources.length === 0)
23
- return emptyMembershipSourcesError();
24
- if (accessMode !== 'org-members')
25
- return membershipSourcesRequireOrgMembersError();
23
+ errors.push(...emptyMembershipSourcesError().errors);
24
+ if (accessMode !== 'org-members') {
25
+ errors.push(...membershipSourcesRequireOrgMembersError().errors);
26
+ }
26
27
  }
28
+ // Only diagnostics cross the registry/API boundary; failed compilation cannot publish metadata.
29
+ if (!built.ok || errors.length > 0)
30
+ return { ok: false, errors };
27
31
  return {
28
32
  ok: true,
29
33
  serverName: built.served.artifact.server.name,
@@ -100,17 +100,19 @@ export async function handleDeployPreflight(req, res, registry, options, maxBody
100
100
  const ownerSelection = await authorizeDeploymentOwnerSelection(res, controlPlane, tenant.org, accessMode, identity, parsed.ownerSubject);
101
101
  if (!ownerSelection.ok)
102
102
  return;
103
+ const requestErrors = [];
103
104
  if (accessMode === 'public' && manifestUsesUserRoot(parsed.manifest)) {
104
- return sendJson(res, 400, {
105
+ requestErrors.push({
105
106
  code: 'public_user_context_conflict',
106
- error: 'public access mode cannot reference ${user}; use mixed for optional identity',
107
+ path: 'accessMode',
108
+ message: 'public access mode cannot reference ${user}; use mixed for optional identity',
107
109
  });
108
110
  }
109
- const [cspFault] = cspFaultsInManifest(parsed.manifest);
110
- if (cspFault !== undefined) {
111
- return sendJson(res, 400, {
111
+ for (const cspFault of cspFaultsInManifest(parsed.manifest)) {
112
+ requestErrors.push({
112
113
  code: 'invalid_widget_csp',
113
- error: `widget "${cspFault.widget}" CSP ${cspFault.list} origin "${cspFault.value}" is not an ` +
114
+ path: `widgets.${cspFault.widgetIndex}.csp.${cspFault.list}.${cspFault.index}`,
115
+ message: `widget "${cspFault.widget}" CSP ${cspFault.list} origin "${cspFault.value}" is not an ` +
114
116
  `absolute https:// origin and would be dropped by the host renderer` +
115
117
  (cspFault.suggestion !== undefined ? `; use "${cspFault.suggestion}"` : ''),
116
118
  });
@@ -149,7 +151,7 @@ export async function handleDeployPreflight(req, res, registry, options, maxBody
149
151
  })
150
152
  .finally(() => clearTimeout(timer));
151
153
  const [application, environment, preflight] = checked;
152
- const errors = preflight.ok ? [] : preflight.errors;
154
+ const errors = [...requestErrors, ...(preflight.ok ? [] : preflight.errors)];
153
155
  const missingSecrets = configNames(errors, 'missing_secret', 'secrets.');
154
156
  const missingVariables = configNames(errors, 'missing_variable', 'variables.');
155
157
  const appState = application === undefined ? 'will-create' : 'existing';
@@ -1,4 +1,4 @@
1
- import { mcpSubdomainEndpointOptions } from '@noodle-borg/control-plane/portable';
1
+ import { mcpSubdomainEndpointOptions, PersonalWorkspaceOwnerMutationError, } from '@noodle-borg/control-plane/portable';
2
2
  import { normalizePublicBaseDomain, OPENAI_APPS_CHALLENGE_PATH } from '@noodle-borg/module';
3
3
  import { readJsonBody, sendJson } from '@noodle-borg/transport-http';
4
4
  import { OrgSummarySchema } from '@noodle-borg/wire-contracts';
@@ -142,7 +142,7 @@ export async function handleMembers(req, res, gate, controlPlane, maxBody, ref,
142
142
  return sendJson(res, 201, { ok: true, member });
143
143
  }
144
144
  catch (error) {
145
- return sendJson(res, 400, { error: error.message });
145
+ return sendMemberMutationError(res, error);
146
146
  }
147
147
  }
148
148
  if (req.method === 'PATCH' && ref.subject !== undefined) {
@@ -177,7 +177,7 @@ export async function handleMembers(req, res, gate, controlPlane, maxBody, ref,
177
177
  return sendJson(res, 200, { ok: true, member });
178
178
  }
179
179
  catch (error) {
180
- return sendJson(res, 400, { error: error.message });
180
+ return sendMemberMutationError(res, error);
181
181
  }
182
182
  }
183
183
  if (req.method === 'DELETE' && ref.subject !== undefined) {
@@ -186,18 +186,28 @@ export async function handleMembers(req, res, gate, controlPlane, maxBody, ref,
186
186
  if (await demotesLastOwner(controlPlane, ref.org, ref.subject, undefined)) {
187
187
  return sendJson(res, 409, { error: 'cannot remove the last owner' });
188
188
  }
189
- const removed = await controlPlane.removeOrgMember({ org: ref.org, subject: ref.subject });
190
- if (removed) {
191
- await emitOrgAudit(audit, 'org.member.removed', ref.org, identity, 204, {
192
- subject: ref.subject,
193
- });
189
+ try {
190
+ const removed = await controlPlane.removeOrgMember({ org: ref.org, subject: ref.subject });
191
+ if (removed) {
192
+ await emitOrgAudit(audit, 'org.member.removed', ref.org, identity, 204, {
193
+ subject: ref.subject,
194
+ });
195
+ }
196
+ res.writeHead(204);
197
+ res.end();
198
+ return;
199
+ }
200
+ catch (error) {
201
+ return sendMemberMutationError(res, error);
194
202
  }
195
- res.writeHead(204);
196
- res.end();
197
- return;
198
203
  }
199
204
  return sendJson(res, 404, { error: 'not found' });
200
205
  }
206
+ function sendMemberMutationError(res, error) {
207
+ sendJson(res, error instanceof PersonalWorkspaceOwnerMutationError ? 409 : 400, {
208
+ error: error.message,
209
+ });
210
+ }
201
211
  export async function handleInvitations(req, res, gate, controlPlane, maxBody, ref, audit, url, invitationEmail = {}, now = () => new Date()) {
202
212
  const identity = await authorizeControlPlane(req, res, gate, { requireIdentity: true });
203
213
  if (identity === false)
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@modelcontextprotocol/sdk": "^1.29.0",
41
41
  "@noodle-borg/admission-limits": "0.0.0",
42
- "@noodle-borg/agent-kit": "0.96.0",
42
+ "@noodle-borg/agent-kit": "0.98.0",
43
43
  "@noodle-borg/app-package": "0.0.0",
44
44
  "@noodle-borg/assistant-gateway": "0.0.0",
45
45
  "@noodle-borg/auth": "0.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noodleseed/one",
3
- "version": "0.159.0",
3
+ "version": "0.161.0",
4
4
  "private": false,
5
5
  "description": "Noodle CLI by Noodle Seed — author, run, and deploy declarative MCP servers. Embedding the assistant in your own web app is @noodleseed/assistant.",
6
6
  "license": "Apache-2.0",
@@ -235,7 +235,7 @@
235
235
  "@modelcontextprotocol/client": "2.0.0",
236
236
  "@modelcontextprotocol/server": "2.0.0",
237
237
  "@noodle-borg/admission-limits": "0.0.0",
238
- "@noodle-borg/agent-kit": "0.96.0",
238
+ "@noodle-borg/agent-kit": "0.98.0",
239
239
  "@noodle-borg/app-audit": "0.0.0",
240
240
  "@noodle-borg/app-package": "0.0.0",
241
241
  "@noodle-borg/assistant-gateway": "0.0.0",