@stigmer/sdk 3.2.3 → 3.3.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.
- package/__tests__/errors.test.js +44 -1
- package/__tests__/errors.test.js.map +1 -1
- package/__tests__/manifest.test.d.ts +2 -0
- package/__tests__/manifest.test.d.ts.map +1 -0
- package/__tests__/manifest.test.js +229 -0
- package/__tests__/manifest.test.js.map +1 -0
- package/billing.d.ts +83 -1
- package/billing.d.ts.map +1 -1
- package/billing.js +91 -1
- package/billing.js.map +1 -1
- package/cursor-accounts.d.ts +94 -0
- package/cursor-accounts.d.ts.map +1 -0
- package/cursor-accounts.js +119 -0
- package/cursor-accounts.js.map +1 -0
- package/errors.d.ts +14 -0
- package/errors.d.ts.map +1 -1
- package/errors.js +26 -0
- package/errors.js.map +1 -1
- package/gen/agent.d.ts +5 -0
- package/gen/agent.d.ts.map +1 -1
- package/gen/agent.js +9 -1
- package/gen/agent.js.map +1 -1
- package/gen/agentexecution.d.ts +1 -0
- package/gen/agentexecution.d.ts.map +1 -1
- package/gen/agentexecution.js +2 -0
- package/gen/agentexecution.js.map +1 -1
- package/gen/agentinstance.d.ts +1 -0
- package/gen/agentinstance.d.ts.map +1 -1
- package/gen/agentinstance.js +1 -0
- package/gen/agentinstance.js.map +1 -1
- package/gen/authorization-config.d.ts.map +1 -1
- package/gen/authorization-config.js +1 -0
- package/gen/authorization-config.js.map +1 -1
- package/gen/client.d.ts +6 -2
- package/gen/client.d.ts.map +1 -1
- package/gen/client.js +4 -0
- package/gen/client.js.map +1 -1
- package/gen/datastore.d.ts +128 -0
- package/gen/datastore.d.ts.map +1 -0
- package/gen/datastore.js +302 -0
- package/gen/datastore.js.map +1 -0
- package/gen/session.d.ts +1 -0
- package/gen/session.d.ts.map +1 -1
- package/gen/session.js +1 -0
- package/gen/session.js.map +1 -1
- package/index.d.ts +5 -3
- package/index.d.ts.map +1 -1
- package/index.js +7 -3
- package/index.js.map +1 -1
- package/manifest/client.d.ts +64 -0
- package/manifest/client.d.ts.map +1 -0
- package/manifest/client.js +109 -0
- package/manifest/client.js.map +1 -0
- package/manifest/index.d.ts +9 -0
- package/manifest/index.d.ts.map +1 -0
- package/manifest/index.js +11 -0
- package/manifest/index.js.map +1 -0
- package/manifest/parse.d.ts +57 -0
- package/manifest/parse.d.ts.map +1 -0
- package/manifest/parse.js +134 -0
- package/manifest/parse.js.map +1 -0
- package/manifest/redaction.d.ts +16 -0
- package/manifest/redaction.d.ts.map +1 -0
- package/manifest/redaction.js +19 -0
- package/manifest/redaction.js.map +1 -0
- package/manifest/registry.d.ts +44 -0
- package/manifest/registry.d.ts.map +1 -0
- package/manifest/registry.js +178 -0
- package/manifest/registry.js.map +1 -0
- package/manifest/serialize.d.ts +24 -0
- package/manifest/serialize.d.ts.map +1 -0
- package/manifest/serialize.js +78 -0
- package/manifest/serialize.js.map +1 -0
- package/package.json +4 -3
- package/src/__tests__/errors.test.ts +58 -0
- package/src/__tests__/manifest.test.ts +271 -0
- package/src/billing.ts +160 -0
- package/src/cursor-accounts.ts +207 -0
- package/src/errors.ts +27 -0
- package/src/gen/agent.ts +15 -1
- package/src/gen/agentexecution.ts +2 -0
- package/src/gen/agentinstance.ts +2 -0
- package/src/gen/authorization-config.ts +1 -0
- package/src/gen/client.ts +7 -2
- package/src/gen/datastore.ts +379 -0
- package/src/gen/session.ts +2 -0
- package/src/index.ts +30 -0
- package/src/manifest/client.ts +145 -0
- package/src/manifest/index.ts +25 -0
- package/src/manifest/parse.ts +204 -0
- package/src/manifest/redaction.ts +20 -0
- package/src/manifest/registry.ts +232 -0
- package/src/manifest/serialize.ts +92 -0
- package/src/stigmer.ts +8 -0
- package/stigmer.d.ts +6 -0
- package/stigmer.d.ts.map +1 -1
- package/stigmer.js +8 -0
- package/stigmer.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { type RunnerAdapter, type RunnerWorkerHost, createRunnerAdapter, } from
|
|
|
3
3
|
export { type StigmerConfig, type TokenProvider } from "./config.js";
|
|
4
4
|
export { createGuestAuth, GuestAuth, type GuestAuthConfig, type GuestIdStorage, } from "./guest-auth.js";
|
|
5
5
|
export { MAX_ALLOWED_ORIGINS, LINK_TOKEN_PARAM, validateOrigin, chatPath, buildChatUrl, appendLinkToken, buildEmbedLoaderUrl, buildEmbedSnippet, } from "./sharing.js";
|
|
6
|
-
export { StigmerError, type ErrorCode, isNotFound, isUnauthenticated, isPermissionDenied, isRetryable, type ErrorCategory, isConnectError, classifyError, isRetryableError, isTransientStreamError, getUserMessage, type ErrorReason, getErrorReason, type RpcErrorMetadata, annotateRpcError, getRpcMetadata, } from "./errors.js";
|
|
6
|
+
export { StigmerError, type ErrorCode, isNotFound, isUnauthenticated, isPermissionDenied, isRetryable, type ErrorCategory, isConnectError, classifyError, isRetryableError, isTransientStreamError, getUserMessage, type ErrorReason, getErrorReason, getRecordConstraint, type RpcErrorMetadata, annotateRpcError, getRpcMetadata, } from "./errors.js";
|
|
7
7
|
export { type DeploymentMode, isResourceAvailable, } from "./resource-availability.js";
|
|
8
8
|
export { getGrantableRoles, hasGrantableRoles, isRoleGrantable, } from "./authorization-config.js";
|
|
9
9
|
export { iamRoleToString, iamRoleFromString, iamRoleDisplayName, iamRoleDescription, } from "./iam-role.js";
|
|
@@ -11,11 +11,13 @@ export { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
|
11
11
|
export { ActivityClient, type ListRecentActivityParams, type ListRecentActivityResponse, } from "./activity.js";
|
|
12
12
|
export type { RecentActivityEntry as RecentActivityEntryProto } from "./activity.js";
|
|
13
13
|
export { BillingClient, type CreateCheckoutSessionParams, type CreateBillingPortalSessionParams, type SetAutoRechargeConfigParams, type GetCreditLedgerParams, type GetBillingUsageReportParams, type GetCustomerModelPricingParams, } from "./billing.js";
|
|
14
|
+
export { CursorAccountsClient, type UpsertCursorAccountParams, type DeleteCursorAccountParams, type AddCursorMemberKeyParams, type RemoveCursorMemberKeyParams, type SetCursorMemberKeyEnabledParams, } from "./cursor-accounts.js";
|
|
14
15
|
export { SearchClient, type SearchParams, type SearchResponse, ApiResourceKind, } from "./search.js";
|
|
15
16
|
export { GitHubClient, type GetOAuthAuthorizeUrlParams, type OAuthAuthorizeUrlResponse, type ExchangeOAuthCodeParams, type OAuthTokenResponse, } from "./github.js";
|
|
16
17
|
export { PlatformClient, type ServerInfo, } from "./platform.js";
|
|
18
|
+
export { ManifestClient, parseManifest, serializeManifest, manifestKinds, manifestHandlerForYamlKind, manifestHandlerForTypeName, metadataOf, REDACTED_SECRET_MARKER, containsRedactedSecrets, type AppliedManifest, type ManifestDocument, type ManifestKindHandler, type ParseManifestOptions, } from "./manifest/index.js";
|
|
17
19
|
export { type DeleteResourceInput, type ResourceRef, type Page, type ListParams, type ListResult, type EnvSpecInput, type EnvVarInput, } from "./gen/types.js";
|
|
18
|
-
export { AgentClient, type AgentInput, type McpServerUsageInput, type ToolApprovalOverrideInput, type SubAgentInput, type McpAccessInput, } from "./gen/agent.js";
|
|
20
|
+
export { AgentClient, buildAgentProto, type AgentInput, type McpServerUsageInput, type ToolApprovalOverrideInput, type SubAgentInput, type McpAccessInput, } from "./gen/agent.js";
|
|
19
21
|
export { AgentChannelClient, type AgentChannelInput, type SlackChannelConfigInput, } from "./gen/agentchannel.js";
|
|
20
22
|
export { AgentExecutionClient, type AgentExecutionInput, type ExecutionConfigInput, type ContextManagementConfigInput, type AttachmentInput, } from "./gen/agentexecution.js";
|
|
21
23
|
export { AgentInstanceClient, type AgentInstanceInput, } from "./gen/agentinstance.js";
|
|
@@ -29,7 +31,7 @@ export { IdentityAccountClient, type IdentityAccountInput, } from "./gen/identit
|
|
|
29
31
|
export { InvitationClient, type InvitationInput, } from "./gen/invitation.js";
|
|
30
32
|
export { IdentityProviderClient, type IdentityProviderInput, } from "./gen/identityprovider.js";
|
|
31
33
|
export { OAuthAppClient, type OAuthAppInput, } from "./gen/oauthapp.js";
|
|
32
|
-
export { McpServerClient, type McpServerInput, type StdioServerConfigInput, type HttpServerConfigInput, type ToolApprovalPolicyInput, } from "./gen/mcpserver.js";
|
|
34
|
+
export { McpServerClient, buildMcpServerProto, type McpServerInput, type StdioServerConfigInput, type HttpServerConfigInput, type ToolApprovalPolicyInput, } from "./gen/mcpserver.js";
|
|
33
35
|
export { OrganizationClient, type OrganizationInput, } from "./gen/organization.js";
|
|
34
36
|
export { PlatformClientClient, type PlatformClientInput, } from "./gen/platformclient.js";
|
|
35
37
|
export { ProjectClient, type ProjectInput } from "./gen/project.js";
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,EACL,eAAe,EACf,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,KAAK,WAAW,EAChB,cAAc,EACd,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,cAAc,EACnB,mBAAmB,GACpB,MAAM,4BAA4B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,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC"}
|
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export { createGuestAuth, GuestAuth, } from "./guest-auth.js";
|
|
|
8
8
|
// Agent sharing (hosted link + embed snippet; framework-free)
|
|
9
9
|
export { MAX_ALLOWED_ORIGINS, LINK_TOKEN_PARAM, validateOrigin, chatPath, buildChatUrl, appendLinkToken, buildEmbedLoaderUrl, buildEmbedSnippet, } from "./sharing.js";
|
|
10
10
|
// Error handling
|
|
11
|
-
export { StigmerError, isNotFound, isUnauthenticated, isPermissionDenied, isRetryable, isConnectError, classifyError, isRetryableError, isTransientStreamError, getUserMessage, getErrorReason, annotateRpcError, getRpcMetadata, } from "./errors.js";
|
|
11
|
+
export { StigmerError, isNotFound, isUnauthenticated, isPermissionDenied, isRetryable, isConnectError, classifyError, isRetryableError, isTransientStreamError, getUserMessage, getErrorReason, getRecordConstraint, annotateRpcError, getRpcMetadata, } from "./errors.js";
|
|
12
12
|
// Resource availability
|
|
13
13
|
export { isResourceAvailable, } from "./resource-availability.js";
|
|
14
14
|
// Authorization config and IAM role utilities
|
|
@@ -19,14 +19,18 @@ export { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
|
19
19
|
export { ActivityClient, } from "./activity.js";
|
|
20
20
|
// Billing client
|
|
21
21
|
export { BillingClient, } from "./billing.js";
|
|
22
|
+
// Cursor accounts client (platform operators only)
|
|
23
|
+
export { CursorAccountsClient, } from "./cursor-accounts.js";
|
|
22
24
|
// Search client
|
|
23
25
|
export { SearchClient, ApiResourceKind, } from "./search.js";
|
|
24
26
|
// GitHub OAuth client
|
|
25
27
|
export { GitHubClient, } from "./github.js";
|
|
26
28
|
// Platform client (server info / edition detection)
|
|
27
29
|
export { PlatformClient, } from "./platform.js";
|
|
30
|
+
// Manifest engine (kind-agnostic YAML ⇄ proto ⇄ apply)
|
|
31
|
+
export { ManifestClient, parseManifest, serializeManifest, manifestKinds, manifestHandlerForYamlKind, manifestHandlerForTypeName, metadataOf, REDACTED_SECRET_MARKER, containsRedactedSecrets, } from "./manifest/index.js";
|
|
28
32
|
// Re-export all resource client classes and input types
|
|
29
|
-
export { AgentClient, } from "./gen/agent.js";
|
|
33
|
+
export { AgentClient, buildAgentProto, } from "./gen/agent.js";
|
|
30
34
|
export { AgentChannelClient, } from "./gen/agentchannel.js";
|
|
31
35
|
export { AgentExecutionClient, } from "./gen/agentexecution.js";
|
|
32
36
|
export { AgentInstanceClient, } from "./gen/agentinstance.js";
|
|
@@ -40,7 +44,7 @@ export { IdentityAccountClient, } from "./gen/identityaccount.js";
|
|
|
40
44
|
export { InvitationClient, } from "./gen/invitation.js";
|
|
41
45
|
export { IdentityProviderClient, } from "./gen/identityprovider.js";
|
|
42
46
|
export { OAuthAppClient, } from "./gen/oauthapp.js";
|
|
43
|
-
export { McpServerClient, } from "./gen/mcpserver.js";
|
|
47
|
+
export { McpServerClient, buildMcpServerProto, } from "./gen/mcpserver.js";
|
|
44
48
|
export { OrganizationClient, } from "./gen/organization.js";
|
|
45
49
|
export { PlatformClientClient, } from "./gen/platformclient.js";
|
|
46
50
|
export { ProjectClient } from "./gen/project.js";
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,iBAAiB;AACjB,OAAO,EAGL,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAK7B,4EAA4E;AAC5E,OAAO,EACL,eAAe,EACf,SAAS,GAGV,MAAM,iBAAiB,CAAC;AAEzB,8DAA8D;AAC9D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,iBAAiB;AACjB,OAAO,EACL,YAAY,EAEZ,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EAEX,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EAEd,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,mBAAmB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AAM,kBAAkB,CAAC;AAE1B,mCAAmC;AACnC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhE,uFAAuF;AACvF,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,GAIpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAmB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,cAAc,GAMf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,GAExB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,GAEvB,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
2
|
+
import { type Transport } from "@connectrpc/connect";
|
|
3
|
+
import { type ManifestDocument } from "./parse.js";
|
|
4
|
+
import { type ManifestKindHandler } from "./registry.js";
|
|
5
|
+
/** Result of applying one manifest document. */
|
|
6
|
+
export interface AppliedManifest {
|
|
7
|
+
/** The YAML kind that was applied, e.g. `"Agent"`. */
|
|
8
|
+
readonly yamlKind: string;
|
|
9
|
+
/** Human-facing kind name, e.g. `"MCP Server"`. */
|
|
10
|
+
readonly displayName: string;
|
|
11
|
+
/** Server-authoritative resource name. */
|
|
12
|
+
readonly name: string;
|
|
13
|
+
/** Server-authoritative slug (routing key for future applies). */
|
|
14
|
+
readonly slug: string;
|
|
15
|
+
/** Organization the resource lives in. */
|
|
16
|
+
readonly org: string;
|
|
17
|
+
/** Server-assigned resource id. */
|
|
18
|
+
readonly id: string;
|
|
19
|
+
/** The full applied resource, as returned by the server. */
|
|
20
|
+
readonly message: Message;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Client for applying and loading Stigmer resources as manifests,
|
|
24
|
+
* independent of kind.
|
|
25
|
+
*
|
|
26
|
+
* Complements the typed per-kind clients (`stigmer.agent`, …): those take
|
|
27
|
+
* curated `*Input` shapes for programmatic use; this one takes full
|
|
28
|
+
* resource protos produced by {@link parseManifest} — the declarative
|
|
29
|
+
* "apply this YAML" path, with the same semantics as `stigmer apply -f`.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const docs = parseManifest(yamlText, { org: "acme" });
|
|
34
|
+
* for (const doc of docs) {
|
|
35
|
+
* const applied = await stigmer.manifest.apply(doc);
|
|
36
|
+
* console.log(`${applied.displayName} ${applied.slug} applied`);
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class ManifestClient {
|
|
41
|
+
private readonly clients;
|
|
42
|
+
private readonly transport;
|
|
43
|
+
private readonly clientFor;
|
|
44
|
+
constructor(transport: Transport);
|
|
45
|
+
/** The kinds this client can apply, in dependency apply order. */
|
|
46
|
+
supportedKinds(): readonly ManifestKindHandler[];
|
|
47
|
+
/**
|
|
48
|
+
* Apply one parsed manifest document (create-or-update by slug).
|
|
49
|
+
*
|
|
50
|
+
* @throws {StigmerError} When the server rejects the apply
|
|
51
|
+
* (validation, permissions, …).
|
|
52
|
+
*/
|
|
53
|
+
apply(document: ManifestDocument): Promise<AppliedManifest>;
|
|
54
|
+
/**
|
|
55
|
+
* Load a resource's current server state by kind + org/slug reference.
|
|
56
|
+
*
|
|
57
|
+
* @returns The resource proto, or `null` when it does not exist —
|
|
58
|
+
* the create-vs-update discriminator for previews.
|
|
59
|
+
* @throws {Error} When the kind is not in the manifest registry.
|
|
60
|
+
* @throws {StigmerError} For failures other than not-found.
|
|
61
|
+
*/
|
|
62
|
+
getByReference(yamlKind: string, org: string, slug: string): Promise<Message | null>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/manifest/client.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,eAAe,CAAC;AAEvB,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,cAAc;IAGzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+C;IACvE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;gBAEhC,SAAS,EAAE,SAAS;IAYhC,kEAAkE;IAClE,cAAc,IAAI,SAAS,mBAAmB,EAAE;IAIhD;;;;;OAKG;IACG,KAAK,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAoBjE;;;;;;;OAOG;IACG,cAAc,CAClB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CAyB3B"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Kind-agnostic apply/lookup over the manifest registry.
|
|
2
|
+
//
|
|
3
|
+
// One client, every registry kind: `apply` drives the kind's command
|
|
4
|
+
// controller with the full resource proto (create-or-update by slug,
|
|
5
|
+
// server-side), `getByReference` loads current server state for
|
|
6
|
+
// create-vs-update previews and YAML editing.
|
|
7
|
+
import { create } from "@bufbuild/protobuf";
|
|
8
|
+
import { createClient } from "@connectrpc/connect";
|
|
9
|
+
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
10
|
+
import { wrapError } from "../gen/errors.js";
|
|
11
|
+
import { metadataOf } from "./parse.js";
|
|
12
|
+
import { manifestHandlerForYamlKind, manifestKinds, } from "./registry.js";
|
|
13
|
+
/**
|
|
14
|
+
* Client for applying and loading Stigmer resources as manifests,
|
|
15
|
+
* independent of kind.
|
|
16
|
+
*
|
|
17
|
+
* Complements the typed per-kind clients (`stigmer.agent`, …): those take
|
|
18
|
+
* curated `*Input` shapes for programmatic use; this one takes full
|
|
19
|
+
* resource protos produced by {@link parseManifest} — the declarative
|
|
20
|
+
* "apply this YAML" path, with the same semantics as `stigmer apply -f`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const docs = parseManifest(yamlText, { org: "acme" });
|
|
25
|
+
* for (const doc of docs) {
|
|
26
|
+
* const applied = await stigmer.manifest.apply(doc);
|
|
27
|
+
* console.log(`${applied.displayName} ${applied.slug} applied`);
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export class ManifestClient {
|
|
32
|
+
// Raw controller clients are created lazily and cached per service —
|
|
33
|
+
// one dialog session typically touches one or two kinds.
|
|
34
|
+
clients = new Map();
|
|
35
|
+
transport;
|
|
36
|
+
clientFor;
|
|
37
|
+
constructor(transport) {
|
|
38
|
+
this.transport = transport;
|
|
39
|
+
this.clientFor = (service) => {
|
|
40
|
+
let client = this.clients.get(service);
|
|
41
|
+
if (client === undefined) {
|
|
42
|
+
client = createClient(service, this.transport);
|
|
43
|
+
this.clients.set(service, client);
|
|
44
|
+
}
|
|
45
|
+
return client;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** The kinds this client can apply, in dependency apply order. */
|
|
49
|
+
supportedKinds() {
|
|
50
|
+
return manifestKinds();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Apply one parsed manifest document (create-or-update by slug).
|
|
54
|
+
*
|
|
55
|
+
* @throws {StigmerError} When the server rejects the apply
|
|
56
|
+
* (validation, permissions, …).
|
|
57
|
+
*/
|
|
58
|
+
async apply(document) {
|
|
59
|
+
let applied;
|
|
60
|
+
try {
|
|
61
|
+
applied = await document.handler.apply(this.clientFor, document.message);
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
throw wrapError(e);
|
|
65
|
+
}
|
|
66
|
+
const metadata = metadataOf(applied);
|
|
67
|
+
return {
|
|
68
|
+
yamlKind: document.handler.yamlKind,
|
|
69
|
+
displayName: document.handler.displayName,
|
|
70
|
+
name: metadata?.name || document.name,
|
|
71
|
+
slug: metadata?.slug || document.slug,
|
|
72
|
+
org: metadata?.org || document.org,
|
|
73
|
+
id: metadata?.id ?? "",
|
|
74
|
+
message: applied,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Load a resource's current server state by kind + org/slug reference.
|
|
79
|
+
*
|
|
80
|
+
* @returns The resource proto, or `null` when it does not exist —
|
|
81
|
+
* the create-vs-update discriminator for previews.
|
|
82
|
+
* @throws {Error} When the kind is not in the manifest registry.
|
|
83
|
+
* @throws {StigmerError} For failures other than not-found.
|
|
84
|
+
*/
|
|
85
|
+
async getByReference(yamlKind, org, slug) {
|
|
86
|
+
const handler = manifestHandlerForYamlKind(yamlKind);
|
|
87
|
+
if (handler === undefined) {
|
|
88
|
+
const supported = manifestKinds()
|
|
89
|
+
.map((h) => h.yamlKind)
|
|
90
|
+
.join(", ");
|
|
91
|
+
throw new Error(`Unsupported resource kind "${yamlKind}". Supported kinds: ${supported}.`);
|
|
92
|
+
}
|
|
93
|
+
const ref = create(ApiResourceReferenceSchema, {
|
|
94
|
+
org,
|
|
95
|
+
slug,
|
|
96
|
+
kind: handler.kind,
|
|
97
|
+
});
|
|
98
|
+
try {
|
|
99
|
+
return await handler.getByReference(this.clientFor, ref);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
const wrapped = wrapError(e);
|
|
103
|
+
if (wrapped.code === "not-found")
|
|
104
|
+
return null;
|
|
105
|
+
throw wrapped;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/manifest/client.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,gEAAgE;AAChE,8CAA8C;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAyB,MAAM,YAAY,CAAC;AAC/D,OAAO,EACL,0BAA0B,EAC1B,aAAa,GAGd,MAAM,eAAe,CAAC;AAoBvB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,cAAc;IACzB,q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AG,EAAE,QAAQ,EAAE,GAAG,IAAI,QAAQ,CAAC,GAAG;YAClC,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE;YACtB,OAAO,EAAE,OAAO;SACjB,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,GAAW,EACX,IAAY;QAEZ,MAAM,OAAO,GAAG,0BAA0B,CAAC,QAAQ,CAAC,CAAC;QACrD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,SAAS,GAAG,aAAa,EAAE;iBAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;iBACtB,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,MAAM,IAAI,KAAK,CACb,8BAA8B,QAAQ,uBAAuB,SAAS,GAAG,CAC1E,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,CAAC,0BAA0B,EAAE;YAC7C,GAAG;YACH,IAAI;YACJ,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YAC7B,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW;gBAAE,OAAO,IAAI,CAAC;YAC9C,MAAM,OAAO,CAAC;QAChB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { manifestKinds, manifestHandlerForYamlKind, manifestHandlerForTypeName, } from "./registry.js";
|
|
2
|
+
export type { ManifestKindHandler, ServiceClientFn } from "./registry.js";
|
|
3
|
+
export { parseManifest, metadataOf } from "./parse.js";
|
|
4
|
+
export type { ManifestDocument, ParseManifestOptions } from "./parse.js";
|
|
5
|
+
export { serializeManifest } from "./serialize.js";
|
|
6
|
+
export { ManifestClient } from "./client.js";
|
|
7
|
+
export type { AppliedManifest } from "./client.js";
|
|
8
|
+
export { REDACTED_SECRET_MARKER, containsRedactedSecrets, } from "./redaction.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Manifest engine: kind-agnostic YAML ⇄ proto ⇄ apply for Stigmer resources.
|
|
2
|
+
//
|
|
3
|
+
// The declarative counterpart to the typed per-kind clients — parse a YAML
|
|
4
|
+
// manifest against generated proto schemas, serialize server state back to
|
|
5
|
+
// editable YAML, and apply through each kind's command controller.
|
|
6
|
+
export { manifestKinds, manifestHandlerForYamlKind, manifestHandlerForTypeName, } from "./registry.js";
|
|
7
|
+
export { parseManifest, metadataOf } from "./parse.js";
|
|
8
|
+
export { serializeManifest } from "./serialize.js";
|
|
9
|
+
export { ManifestClient } from "./client.js";
|
|
10
|
+
export { REDACTED_SECRET_MARKER, containsRedactedSecrets, } from "./redaction.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,mEAAmE;AAEnE,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Message } from "@bufbuild/protobuf";
|
|
2
|
+
import { type ApiResourceMetadata } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
3
|
+
import { type ManifestKindHandler } from "./registry.js";
|
|
4
|
+
/** Options for {@link parseManifest}. */
|
|
5
|
+
export interface ParseManifestOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Target organization slug. Injected into `metadata.org` when the document
|
|
8
|
+
* omits it. When the document specifies a *different* org, the document's
|
|
9
|
+
* value wins and a warning is attached (matching `stigmer apply`).
|
|
10
|
+
*/
|
|
11
|
+
readonly org?: string;
|
|
12
|
+
}
|
|
13
|
+
/** One resource document parsed from a manifest. */
|
|
14
|
+
export interface ManifestDocument {
|
|
15
|
+
/** The registry handler for this document's kind. */
|
|
16
|
+
readonly handler: ManifestKindHandler;
|
|
17
|
+
/** The fully-marshalled resource proto, ready for `apply`. */
|
|
18
|
+
readonly message: Message;
|
|
19
|
+
/** `metadata.name` (always present — validated). */
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/** `metadata.slug`, or the name when the document has no explicit slug. */
|
|
22
|
+
readonly slug: string;
|
|
23
|
+
/** `metadata.org` after org injection ("" when unresolvable). */
|
|
24
|
+
readonly org: string;
|
|
25
|
+
/** Org-mismatch warning, when the document's org differs from the target. */
|
|
26
|
+
readonly warning?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse a (possibly multi-document) YAML manifest into resource protos.
|
|
30
|
+
*
|
|
31
|
+
* Each document is validated against its kind's generated proto schema —
|
|
32
|
+
* the same schemas the backend serves — so a document that parses here is
|
|
33
|
+
* structurally valid for `apply`. Documents are returned in **dependency
|
|
34
|
+
* apply order** (referenced kinds before dependents, stable within a kind),
|
|
35
|
+
* mirroring the CLI's apply ordering.
|
|
36
|
+
*
|
|
37
|
+
* @param content - Raw YAML text (one or more `---`-separated documents).
|
|
38
|
+
* @param options - Optional target org for `metadata.org` injection.
|
|
39
|
+
* @returns The parsed documents, sorted into dependency apply order.
|
|
40
|
+
* @throws {Error} With a user-facing message when the YAML is malformed,
|
|
41
|
+
* a document has no `kind`, the kind is unsupported, or a document does
|
|
42
|
+
* not match its proto schema (unknown fields included).
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { parseManifest } from "@stigmer/sdk";
|
|
47
|
+
*
|
|
48
|
+
* const docs = parseManifest(yamlText, { org: "acme" });
|
|
49
|
+
* for (const doc of docs) {
|
|
50
|
+
* await stigmer.manifest.apply(doc);
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function parseManifest(content: string, options?: ParseManifestOptions): ManifestDocument[];
|
|
55
|
+
/** Read a resource message's metadata envelope, if present. */
|
|
56
|
+
export declare function metadataOf(message: Message): ApiResourceMetadata | undefined;
|
|
57
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/manifest/parse.ts"],"names":[],"mappings":"AAQA,OAAO,EAA4B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,4DAA4D,CAAC;AAEpE,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,eAAe,CAAC;AAEvB,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,oBAAyB,GACjC,gBAAgB,EAAE,CAwCpB;AAyDD,+DAA+D;AAC/D,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB,GAAG,SAAS,CAE5E"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Strict YAML → proto parsing for Stigmer resource manifests.
|
|
2
|
+
//
|
|
3
|
+
// The strictness contract matches `stigmer apply -f`: YAML syntax errors and
|
|
4
|
+
// unknown fields both fail loudly (`ignoreUnknownFields: false`) — silently
|
|
5
|
+
// applying a half-parsed or typo'd document would be dangerous. Error
|
|
6
|
+
// messages are written for end users (DD-006): what failed, where, and what
|
|
7
|
+
// a valid document looks like.
|
|
8
|
+
import { fromJson } from "@bufbuild/protobuf";
|
|
9
|
+
import { create } from "@bufbuild/protobuf";
|
|
10
|
+
import { ApiResourceMetadataSchema, } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
11
|
+
import { parseAllDocuments } from "yaml";
|
|
12
|
+
import { manifestHandlerForYamlKind, manifestKinds, } from "./registry.js";
|
|
13
|
+
/**
|
|
14
|
+
* Parse a (possibly multi-document) YAML manifest into resource protos.
|
|
15
|
+
*
|
|
16
|
+
* Each document is validated against its kind's generated proto schema —
|
|
17
|
+
* the same schemas the backend serves — so a document that parses here is
|
|
18
|
+
* structurally valid for `apply`. Documents are returned in **dependency
|
|
19
|
+
* apply order** (referenced kinds before dependents, stable within a kind),
|
|
20
|
+
* mirroring the CLI's apply ordering.
|
|
21
|
+
*
|
|
22
|
+
* @param content - Raw YAML text (one or more `---`-separated documents).
|
|
23
|
+
* @param options - Optional target org for `metadata.org` injection.
|
|
24
|
+
* @returns The parsed documents, sorted into dependency apply order.
|
|
25
|
+
* @throws {Error} With a user-facing message when the YAML is malformed,
|
|
26
|
+
* a document has no `kind`, the kind is unsupported, or a document does
|
|
27
|
+
* not match its proto schema (unknown fields included).
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { parseManifest } from "@stigmer/sdk";
|
|
32
|
+
*
|
|
33
|
+
* const docs = parseManifest(yamlText, { org: "acme" });
|
|
34
|
+
* for (const doc of docs) {
|
|
35
|
+
* await stigmer.manifest.apply(doc);
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export function parseManifest(content, options = {}) {
|
|
40
|
+
if (!content.trim()) {
|
|
41
|
+
throw new Error("The manifest is empty. Paste or upload a Stigmer resource YAML " +
|
|
42
|
+
"(a document with apiVersion, kind, metadata, and spec).");
|
|
43
|
+
}
|
|
44
|
+
const parsed = parseAllDocuments(content);
|
|
45
|
+
const documents = [];
|
|
46
|
+
for (const [index, doc] of parsed.entries()) {
|
|
47
|
+
const where = parsed.length === 1 ? "the manifest" : `document ${index + 1}`;
|
|
48
|
+
if (doc.errors.length > 0) {
|
|
49
|
+
throw new Error(`Invalid YAML in ${where}: ${doc.errors[0].message}`);
|
|
50
|
+
}
|
|
51
|
+
const value = doc.toJS();
|
|
52
|
+
if (value === null || value === undefined)
|
|
53
|
+
continue; // blank document between separators
|
|
54
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
55
|
+
throw new Error(`Invalid YAML in ${where}: expected a mapping document with ` +
|
|
56
|
+
"apiVersion, kind, metadata, and spec.");
|
|
57
|
+
}
|
|
58
|
+
documents.push(parseDocument(value, where, options.org));
|
|
59
|
+
}
|
|
60
|
+
if (documents.length === 0) {
|
|
61
|
+
throw new Error("The manifest contains no resource documents. Each document needs " +
|
|
62
|
+
"at least a kind (e.g. kind: Agent) and metadata.name.");
|
|
63
|
+
}
|
|
64
|
+
// Stable sort into dependency order so multi-document manifests apply
|
|
65
|
+
// parents before dependents (e.g. Environment before AgentChannel).
|
|
66
|
+
return documents.sort((a, b) => a.handler.applyOrder - b.handler.applyOrder);
|
|
67
|
+
}
|
|
68
|
+
function parseDocument(value, where, org) {
|
|
69
|
+
const kind = value.kind;
|
|
70
|
+
if (typeof kind !== "string" || kind === "") {
|
|
71
|
+
throw new Error(`${capitalize(where)} is missing the required 'kind' field ` +
|
|
72
|
+
"(e.g. kind: Agent).");
|
|
73
|
+
}
|
|
74
|
+
const handler = manifestHandlerForYamlKind(kind);
|
|
75
|
+
if (handler === undefined) {
|
|
76
|
+
const supported = manifestKinds()
|
|
77
|
+
.map((h) => h.yamlKind)
|
|
78
|
+
.join(", ");
|
|
79
|
+
throw new Error(`Unsupported resource kind "${kind}" in ${where}. ` +
|
|
80
|
+
`Supported kinds: ${supported}.`);
|
|
81
|
+
}
|
|
82
|
+
let message;
|
|
83
|
+
try {
|
|
84
|
+
message = fromJson(handler.schema, value, {
|
|
85
|
+
ignoreUnknownFields: false,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
throw new Error(`Invalid ${handler.displayName} in ${where}: ${err.message}`);
|
|
90
|
+
}
|
|
91
|
+
const warning = injectOrg(message, org ?? "");
|
|
92
|
+
const metadata = metadataOf(message);
|
|
93
|
+
const name = metadata?.name ?? "";
|
|
94
|
+
if (name === "") {
|
|
95
|
+
throw new Error(`${capitalize(where)} is missing the required metadata.name field.`);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
handler,
|
|
99
|
+
message,
|
|
100
|
+
name,
|
|
101
|
+
slug: metadata?.slug || name,
|
|
102
|
+
org: metadata?.org ?? "",
|
|
103
|
+
...(warning !== undefined && { warning }),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** Read a resource message's metadata envelope, if present. */
|
|
107
|
+
export function metadataOf(message) {
|
|
108
|
+
return message.metadata;
|
|
109
|
+
}
|
|
110
|
+
// Inject the target org into metadata.org when the document omitted it. When
|
|
111
|
+
// the document specifies a *different* org, the document's value is honored
|
|
112
|
+
// and a warning is returned (matching `stigmer apply`).
|
|
113
|
+
function injectOrg(message, org) {
|
|
114
|
+
if (org === "")
|
|
115
|
+
return undefined;
|
|
116
|
+
const holder = message;
|
|
117
|
+
if (holder.metadata === undefined) {
|
|
118
|
+
holder.metadata = create(ApiResourceMetadataSchema, { org });
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
if (holder.metadata.org === "") {
|
|
122
|
+
holder.metadata.org = org;
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
if (holder.metadata.org !== org) {
|
|
126
|
+
return (`The document's org "${holder.metadata.org}" differs from the ` +
|
|
127
|
+
`target org "${org}"; applying to "${holder.metadata.org}".`);
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
function capitalize(text) {
|
|
132
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
133
|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AACxD,SAAS,SAAS,CAAC,OAAgB,EAAE,GAAW;IAC9C,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,MAAM,GAAG,OAAwD,CAAC;IACxE,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,yBAAyB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC;QAC/B,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;QAChC,OAAO,CACL,uBAAuB,MAAM,CAAC,QAAQ,CAAC,GAAG,qBAAqB;YAC/D,eAAe,GAAG,mBAAmB,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentinel the server substitutes for secret values before they leave the
|
|
3
|
+
* backend (Cloud environment reads, ChannelApp/OAuthApp reads on both
|
|
4
|
+
* editions). Sending the marker back in an `apply` means "keep the stored
|
|
5
|
+
* secret" — the update pipelines restore the existing encrypted value.
|
|
6
|
+
*/
|
|
7
|
+
export declare const REDACTED_SECRET_MARKER = "***REDACTED***";
|
|
8
|
+
/**
|
|
9
|
+
* Whether manifest content contains redacted secret values.
|
|
10
|
+
*
|
|
11
|
+
* Used by editing UIs to explain the marker to users ("redacted secrets
|
|
12
|
+
* keep their stored values when applied") instead of letting it read like
|
|
13
|
+
* a bug.
|
|
14
|
+
*/
|
|
15
|
+
export declare function containsRedactedSecrets(content: string): boolean;
|
|
16
|
+
//# sourceMappingURL=redaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redaction.d.ts","sourceRoot":"","sources":["../../src/manifest/redaction.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// The server-side secret-redaction contract, mirrored for client UX.
|
|
2
|
+
/**
|
|
3
|
+
* Sentinel the server substitutes for secret values before they leave the
|
|
4
|
+
* backend (Cloud environment reads, ChannelApp/OAuthApp reads on both
|
|
5
|
+
* editions). Sending the marker back in an `apply` means "keep the stored
|
|
6
|
+
* secret" — the update pipelines restore the existing encrypted value.
|
|
7
|
+
*/
|
|
8
|
+
export const REDACTED_SECRET_MARKER = "***REDACTED***";
|
|
9
|
+
/**
|
|
10
|
+
* Whether manifest content contains redacted secret values.
|
|
11
|
+
*
|
|
12
|
+
* Used by editing UIs to explain the marker to users ("redacted secrets
|
|
13
|
+
* keep their stored values when applied") instead of letting it read like
|
|
14
|
+
* a bug.
|
|
15
|
+
*/
|
|
16
|
+
export function containsRedactedSecrets(content) {
|
|
17
|
+
return content.includes(REDACTED_SECRET_MARKER);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=redaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redaction.js","sourceRoot":"","sources":["../../src/manifest/redaction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,OAAO,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DescMessage, DescService, Message } from "@bufbuild/protobuf";
|
|
2
|
+
import type { Client } from "@connectrpc/connect";
|
|
3
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
4
|
+
import type { ApiResourceReference } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
5
|
+
/**
|
|
6
|
+
* Accessor for a raw Connect client over a generated service controller.
|
|
7
|
+
* Implementations cache clients per service (see `ManifestClient`).
|
|
8
|
+
*/
|
|
9
|
+
export type ServiceClientFn = <Desc extends DescService>(service: Desc) => Client<Desc>;
|
|
10
|
+
/**
|
|
11
|
+
* Binds one YAML `kind` to everything the manifest engine needs:
|
|
12
|
+
* the proto schema (strict marshalling), the command controller's `apply`
|
|
13
|
+
* RPC, and the query controller's `getByReference` RPC (create-vs-update
|
|
14
|
+
* preview).
|
|
15
|
+
*/
|
|
16
|
+
export interface ManifestKindHandler {
|
|
17
|
+
/** The platform resource kind enum value. */
|
|
18
|
+
readonly kind: ApiResourceKind;
|
|
19
|
+
/** The YAML discriminator, e.g. `"Agent"`. */
|
|
20
|
+
readonly yamlKind: string;
|
|
21
|
+
/** Human-facing name for messages, e.g. `"MCP Server"`. */
|
|
22
|
+
readonly displayName: string;
|
|
23
|
+
/** Canonical `apiVersion` for this kind, e.g. `"agentic.stigmer.ai/v1"`. */
|
|
24
|
+
readonly apiVersion: string;
|
|
25
|
+
/** Proto schema for strict YAML↔proto conversion. */
|
|
26
|
+
readonly schema: DescMessage;
|
|
27
|
+
/**
|
|
28
|
+
* Position in the dependency apply order (ascending). Referenced kinds
|
|
29
|
+
* apply before their dependents, e.g. an McpServer before the Agent that
|
|
30
|
+
* uses it, and everything an AgentChannel references before the channel.
|
|
31
|
+
*/
|
|
32
|
+
readonly applyOrder: number;
|
|
33
|
+
/** Drive the command controller's `apply` RPC with the full resource. */
|
|
34
|
+
apply(clientFor: ServiceClientFn, message: Message): Promise<Message>;
|
|
35
|
+
/** Load the current server state by org/slug reference. */
|
|
36
|
+
getByReference(clientFor: ServiceClientFn, ref: ApiResourceReference): Promise<Message>;
|
|
37
|
+
}
|
|
38
|
+
/** All kinds the manifest engine supports, in dependency apply order. */
|
|
39
|
+
export declare function manifestKinds(): readonly ManifestKindHandler[];
|
|
40
|
+
/** Resolve a handler by its YAML `kind` discriminator (e.g. `"Agent"`). */
|
|
41
|
+
export declare function manifestHandlerForYamlKind(yamlKind: string): ManifestKindHandler | undefined;
|
|
42
|
+
/** Resolve a handler from a proto message's fully-qualified type name. */
|
|
43
|
+
export declare function manifestHandlerForTypeName(typeName: string): ManifestKindHandler | undefined;
|
|
44
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/manifest/registry.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAoCjG;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,SAAS,WAAW,EAAE,OAAO,EAAE,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;AAExF;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,8CAA8C;IAC9C,QAAQ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