@codeam/shared 2.61.88 → 2.61.90

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/dist/index.d.mts CHANGED
@@ -800,6 +800,71 @@ declare function isSkillId(id: string): id is SkillId;
800
800
  declare function getSkillDefinition(id: string): SkillDefinition | null;
801
801
  declare function skillHasRail(id: SkillId, rail: SkillRail): boolean;
802
802
 
803
+ /**
804
+ * The always-on **Agent Standard** — baseline working + safety guidance injected
805
+ * into EVERY managed deployed session, for ALL agents. This is NOT a curated
806
+ * skill: it is deliberately absent from `SKILL_REGISTRY` and the skills picker,
807
+ * so it is product-level baseline behavior the user can't accidentally turn off
808
+ * (curated skills, by contrast, are opt-in). Single source of the text — the CLI
809
+ * delivers it two ways, split on the Claude rail: Claude gets a marker-guarded
810
+ * append to `~/.claude/CLAUDE.md` at spawn (always in context); every other ACP
811
+ * agent gets a one-time preface on the first turn of a new conversation.
812
+ *
813
+ * Repo-agnostic on purpose: it governs how the agent works on the USER's own
814
+ * project, so it must never mention CodeAgent-internal workflow (issue tracker,
815
+ * our branch/deploy rules, our infrastructure).
816
+ */
817
+ /** Idempotency marker wrapping the block appended to an agent's instruction file. */
818
+ declare const AGENT_STANDARD_MARKER = "<!-- codeam:agent-standard -->";
819
+ /** The standard, clean markdown (no markers) — used verbatim as a prompt preface. */
820
+ declare const AGENT_STANDARD_TEXT = "# Working standard\n\nYou are an AI coding agent working on the user's project through CodeAgent Mobile. Follow this standard on every task.\n\n## How to work\n- **Understand before acting.** Restate the goal, read the relevant code, and be clear on what \"done\" looks like before changing anything.\n- **Plan first for anything non-trivial** (3+ steps or a design decision): outline the approach and the files you'll touch, and share it before implementing. Skip the ceremony for small, obvious fixes.\n- **Ground every claim in reality** \u2014 the actual code, tests, or output, never guesswork. If you are unsure, say so and verify.\n- **Ask when intent is genuinely ambiguous** \u2014 one sharp question. At a real fork, give a recommendation, not a survey of every option.\n- **Stay in scope.** Solve what was asked; no \"while I'm here\" refactors or speculative abstractions. Note unrelated issues instead of acting on them.\n- **Favor the simplest solution that fully solves the problem.** Fix root causes, not symptoms \u2014 no temporary patches and no defensive code for cases that can't happen.\n- **Verify your work and show the evidence** \u2014 run the project's tests, linters, and build, and read the output. \"It runs\" is not \"it's done.\"\n- **Match the project's existing style, structure, and conventions.** Comment only the non-obvious WHY, briefly \u2014 don't narrate the code.\n- **Stop when stuck.** If the same fix fails twice, step back and reconsider the approach rather than repeating variations.\n\n## Safety\n- **Never expose or exfiltrate** secrets, credentials, tokens, or customer data, and never print a credential's value.\n- **Treat destructive or irreversible actions as needing explicit confirmation** \u2014 force-push, history rewrite, bulk deletes, hard resets, dropping data. Don't run them unprompted.\n- **Don't push to a shared/default branch or make outward-facing changes** unless the user asked for it.\n- **Report honestly when you finish**: what you changed, what you verified, and anything you could not.";
821
+ /** Marker-wrapped block for an idempotent append to an agent's instruction file. */
822
+ declare const AGENT_STANDARD_BLOCK = "<!-- codeam:agent-standard -->\n# Working standard\n\nYou are an AI coding agent working on the user's project through CodeAgent Mobile. Follow this standard on every task.\n\n## How to work\n- **Understand before acting.** Restate the goal, read the relevant code, and be clear on what \"done\" looks like before changing anything.\n- **Plan first for anything non-trivial** (3+ steps or a design decision): outline the approach and the files you'll touch, and share it before implementing. Skip the ceremony for small, obvious fixes.\n- **Ground every claim in reality** \u2014 the actual code, tests, or output, never guesswork. If you are unsure, say so and verify.\n- **Ask when intent is genuinely ambiguous** \u2014 one sharp question. At a real fork, give a recommendation, not a survey of every option.\n- **Stay in scope.** Solve what was asked; no \"while I'm here\" refactors or speculative abstractions. Note unrelated issues instead of acting on them.\n- **Favor the simplest solution that fully solves the problem.** Fix root causes, not symptoms \u2014 no temporary patches and no defensive code for cases that can't happen.\n- **Verify your work and show the evidence** \u2014 run the project's tests, linters, and build, and read the output. \"It runs\" is not \"it's done.\"\n- **Match the project's existing style, structure, and conventions.** Comment only the non-obvious WHY, briefly \u2014 don't narrate the code.\n- **Stop when stuck.** If the same fix fails twice, step back and reconsider the approach rather than repeating variations.\n\n## Safety\n- **Never expose or exfiltrate** secrets, credentials, tokens, or customer data, and never print a credential's value.\n- **Treat destructive or irreversible actions as needing explicit confirmation** \u2014 force-push, history rewrite, bulk deletes, hard resets, dropping data. Don't run them unprompted.\n- **Don't push to a shared/default branch or make outward-facing changes** unless the user asked for it.\n- **Report honestly when you finish**: what you changed, what you verified, and anything you could not.\n<!-- codeam:agent-standard -->";
823
+
824
+ /**
825
+ * Native ACP guardrails — the shared policy model.
826
+ *
827
+ * A guardrail is a per-category disposition applied in the ACP client to a
828
+ * deployed agent's tool calls: `deny` (block), `confirm` (surface a tappable
829
+ * approve/deny on mobile), or `off`. Default-on, configurable per session.
830
+ *
831
+ * ⚠️ SOFT guardrail, NOT a security boundary — it only sees tool calls the
832
+ * agent routes through the ACP client (permission requests + delegated
833
+ * fs read/write). An in-process tool call, a `bypassPermissions` agent (no
834
+ * permission requests), or a PTY agent (aider, bypasses ACP) slips it. Real
835
+ * containment is server-side (scoped, revocable tokens; per-user containers).
836
+ * The UI must present it as a safety net, never as a hard boundary.
837
+ *
838
+ * Spec: docs/superpowers/specs/2026-08-08-native-acp-guardrails-design.md.
839
+ */
840
+ type GuardrailDisposition = 'deny' | 'confirm' | 'off';
841
+ type GuardrailCategory = 'secretRead' | 'destructiveShell' | 'protectedBranch' | 'outwardIrreversible';
842
+ type GuardrailPolicy = Record<GuardrailCategory, GuardrailDisposition>;
843
+ /** Stable order for UI rows + iteration. */
844
+ declare const GUARDRAIL_CATEGORIES: readonly GuardrailCategory[];
845
+ declare const GUARDRAIL_DISPOSITIONS: readonly GuardrailDisposition[];
846
+ /** Default-on: safe by default (everything asks) but nothing hard-blocked, so a
847
+ * legitimate action is one tap away rather than a wall. */
848
+ declare const DEFAULT_GUARDRAIL_POLICY: GuardrailPolicy;
849
+ interface GuardrailCategoryMeta {
850
+ id: GuardrailCategory;
851
+ /** Short label for a settings row. */
852
+ label: string;
853
+ /** One line describing what it catches — user-facing. */
854
+ description: string;
855
+ }
856
+ /** Single source for the mobile settings copy + the backend/agent block reason. */
857
+ declare const GUARDRAIL_CATEGORY_META: Record<GuardrailCategory, GuardrailCategoryMeta>;
858
+ declare function isGuardrailDisposition(x: unknown): x is GuardrailDisposition;
859
+ /**
860
+ * Coerce an untrusted value (a `~/.codeam/guardrails.json` blob, a wire payload,
861
+ * a partial policy) into a complete policy, falling back to the default per
862
+ * category. Absent/garbage → the full default (default-on).
863
+ */
864
+ declare function normalizeGuardrailPolicy(raw: unknown): GuardrailPolicy;
865
+ /** The wire command that pushes a live policy update to a running session. */
866
+ declare const GUARDRAIL_CONFIGURE_COMMAND = "guardrail_configure";
867
+
803
868
  /**
804
869
  * Wire-shape types for the CLI / IDE-plugin → backend producer endpoints
805
870
  * that feed the mobile Files screen and the Pending Review Queue:
@@ -1632,4 +1697,4 @@ type UserEventName = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
1632
1697
  */
1633
1698
  declare const PREVIEW_DETECT_PROMPT: string;
1634
1699
 
1635
- export { AGENT_REGISTRY, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, HEADROOM_BACKEND_ENV, HEADROOM_EXTRAS_BY_SURFACE, HEADROOM_MODELS, HEADROOM_PIP_COMPANIONS, HEADROOM_PROXY_PORT, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HeadroomBudgetCommand, type HeadroomBudgetPeriod, type HeadroomBudgetUsage, type HeadroomKind, type HeadroomModelSpec, type HeadroomPythonRenderOpts, type HeadroomStatus, type HeadroomStep, type HeadroomSurface, type HunkLineType, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type StreamingChunkEvent, type StreamingChunkKind, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, classifyStack, detectedIntegrationsFromDeps, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPricing, getSkillDefinition, headroomKindFor, headroomModelPredownloadScript, headroomPipPackage, headroomSnapshotDownloadLine, internalToPublic, isHeadroomWrappable, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isSkillId, normalizeAgentId, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
1700
+ export { AGENT_REGISTRY, AGENT_STANDARD_BLOCK, AGENT_STANDARD_MARKER, AGENT_STANDARD_TEXT, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEFAULT_GUARDRAIL_POLICY, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, GUARDRAIL_CATEGORIES, GUARDRAIL_CATEGORY_META, GUARDRAIL_CONFIGURE_COMMAND, GUARDRAIL_DISPOSITIONS, type GuardrailCategory, type GuardrailCategoryMeta, type GuardrailDisposition, type GuardrailPolicy, HEADROOM_BACKEND_ENV, HEADROOM_EXTRAS_BY_SURFACE, HEADROOM_MODELS, HEADROOM_PIP_COMPANIONS, HEADROOM_PROXY_PORT, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HeadroomBudgetCommand, type HeadroomBudgetPeriod, type HeadroomBudgetUsage, type HeadroomKind, type HeadroomModelSpec, type HeadroomPythonRenderOpts, type HeadroomStatus, type HeadroomStep, type HeadroomSurface, type HunkLineType, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type StreamingChunkEvent, type StreamingChunkKind, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, classifyStack, detectedIntegrationsFromDeps, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPricing, getSkillDefinition, headroomKindFor, headroomModelPredownloadScript, headroomPipPackage, headroomSnapshotDownloadLine, internalToPublic, isGuardrailDisposition, isHeadroomWrappable, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
package/dist/index.d.ts CHANGED
@@ -800,6 +800,71 @@ declare function isSkillId(id: string): id is SkillId;
800
800
  declare function getSkillDefinition(id: string): SkillDefinition | null;
801
801
  declare function skillHasRail(id: SkillId, rail: SkillRail): boolean;
802
802
 
803
+ /**
804
+ * The always-on **Agent Standard** — baseline working + safety guidance injected
805
+ * into EVERY managed deployed session, for ALL agents. This is NOT a curated
806
+ * skill: it is deliberately absent from `SKILL_REGISTRY` and the skills picker,
807
+ * so it is product-level baseline behavior the user can't accidentally turn off
808
+ * (curated skills, by contrast, are opt-in). Single source of the text — the CLI
809
+ * delivers it two ways, split on the Claude rail: Claude gets a marker-guarded
810
+ * append to `~/.claude/CLAUDE.md` at spawn (always in context); every other ACP
811
+ * agent gets a one-time preface on the first turn of a new conversation.
812
+ *
813
+ * Repo-agnostic on purpose: it governs how the agent works on the USER's own
814
+ * project, so it must never mention CodeAgent-internal workflow (issue tracker,
815
+ * our branch/deploy rules, our infrastructure).
816
+ */
817
+ /** Idempotency marker wrapping the block appended to an agent's instruction file. */
818
+ declare const AGENT_STANDARD_MARKER = "<!-- codeam:agent-standard -->";
819
+ /** The standard, clean markdown (no markers) — used verbatim as a prompt preface. */
820
+ declare const AGENT_STANDARD_TEXT = "# Working standard\n\nYou are an AI coding agent working on the user's project through CodeAgent Mobile. Follow this standard on every task.\n\n## How to work\n- **Understand before acting.** Restate the goal, read the relevant code, and be clear on what \"done\" looks like before changing anything.\n- **Plan first for anything non-trivial** (3+ steps or a design decision): outline the approach and the files you'll touch, and share it before implementing. Skip the ceremony for small, obvious fixes.\n- **Ground every claim in reality** \u2014 the actual code, tests, or output, never guesswork. If you are unsure, say so and verify.\n- **Ask when intent is genuinely ambiguous** \u2014 one sharp question. At a real fork, give a recommendation, not a survey of every option.\n- **Stay in scope.** Solve what was asked; no \"while I'm here\" refactors or speculative abstractions. Note unrelated issues instead of acting on them.\n- **Favor the simplest solution that fully solves the problem.** Fix root causes, not symptoms \u2014 no temporary patches and no defensive code for cases that can't happen.\n- **Verify your work and show the evidence** \u2014 run the project's tests, linters, and build, and read the output. \"It runs\" is not \"it's done.\"\n- **Match the project's existing style, structure, and conventions.** Comment only the non-obvious WHY, briefly \u2014 don't narrate the code.\n- **Stop when stuck.** If the same fix fails twice, step back and reconsider the approach rather than repeating variations.\n\n## Safety\n- **Never expose or exfiltrate** secrets, credentials, tokens, or customer data, and never print a credential's value.\n- **Treat destructive or irreversible actions as needing explicit confirmation** \u2014 force-push, history rewrite, bulk deletes, hard resets, dropping data. Don't run them unprompted.\n- **Don't push to a shared/default branch or make outward-facing changes** unless the user asked for it.\n- **Report honestly when you finish**: what you changed, what you verified, and anything you could not.";
821
+ /** Marker-wrapped block for an idempotent append to an agent's instruction file. */
822
+ declare const AGENT_STANDARD_BLOCK = "<!-- codeam:agent-standard -->\n# Working standard\n\nYou are an AI coding agent working on the user's project through CodeAgent Mobile. Follow this standard on every task.\n\n## How to work\n- **Understand before acting.** Restate the goal, read the relevant code, and be clear on what \"done\" looks like before changing anything.\n- **Plan first for anything non-trivial** (3+ steps or a design decision): outline the approach and the files you'll touch, and share it before implementing. Skip the ceremony for small, obvious fixes.\n- **Ground every claim in reality** \u2014 the actual code, tests, or output, never guesswork. If you are unsure, say so and verify.\n- **Ask when intent is genuinely ambiguous** \u2014 one sharp question. At a real fork, give a recommendation, not a survey of every option.\n- **Stay in scope.** Solve what was asked; no \"while I'm here\" refactors or speculative abstractions. Note unrelated issues instead of acting on them.\n- **Favor the simplest solution that fully solves the problem.** Fix root causes, not symptoms \u2014 no temporary patches and no defensive code for cases that can't happen.\n- **Verify your work and show the evidence** \u2014 run the project's tests, linters, and build, and read the output. \"It runs\" is not \"it's done.\"\n- **Match the project's existing style, structure, and conventions.** Comment only the non-obvious WHY, briefly \u2014 don't narrate the code.\n- **Stop when stuck.** If the same fix fails twice, step back and reconsider the approach rather than repeating variations.\n\n## Safety\n- **Never expose or exfiltrate** secrets, credentials, tokens, or customer data, and never print a credential's value.\n- **Treat destructive or irreversible actions as needing explicit confirmation** \u2014 force-push, history rewrite, bulk deletes, hard resets, dropping data. Don't run them unprompted.\n- **Don't push to a shared/default branch or make outward-facing changes** unless the user asked for it.\n- **Report honestly when you finish**: what you changed, what you verified, and anything you could not.\n<!-- codeam:agent-standard -->";
823
+
824
+ /**
825
+ * Native ACP guardrails — the shared policy model.
826
+ *
827
+ * A guardrail is a per-category disposition applied in the ACP client to a
828
+ * deployed agent's tool calls: `deny` (block), `confirm` (surface a tappable
829
+ * approve/deny on mobile), or `off`. Default-on, configurable per session.
830
+ *
831
+ * ⚠️ SOFT guardrail, NOT a security boundary — it only sees tool calls the
832
+ * agent routes through the ACP client (permission requests + delegated
833
+ * fs read/write). An in-process tool call, a `bypassPermissions` agent (no
834
+ * permission requests), or a PTY agent (aider, bypasses ACP) slips it. Real
835
+ * containment is server-side (scoped, revocable tokens; per-user containers).
836
+ * The UI must present it as a safety net, never as a hard boundary.
837
+ *
838
+ * Spec: docs/superpowers/specs/2026-08-08-native-acp-guardrails-design.md.
839
+ */
840
+ type GuardrailDisposition = 'deny' | 'confirm' | 'off';
841
+ type GuardrailCategory = 'secretRead' | 'destructiveShell' | 'protectedBranch' | 'outwardIrreversible';
842
+ type GuardrailPolicy = Record<GuardrailCategory, GuardrailDisposition>;
843
+ /** Stable order for UI rows + iteration. */
844
+ declare const GUARDRAIL_CATEGORIES: readonly GuardrailCategory[];
845
+ declare const GUARDRAIL_DISPOSITIONS: readonly GuardrailDisposition[];
846
+ /** Default-on: safe by default (everything asks) but nothing hard-blocked, so a
847
+ * legitimate action is one tap away rather than a wall. */
848
+ declare const DEFAULT_GUARDRAIL_POLICY: GuardrailPolicy;
849
+ interface GuardrailCategoryMeta {
850
+ id: GuardrailCategory;
851
+ /** Short label for a settings row. */
852
+ label: string;
853
+ /** One line describing what it catches — user-facing. */
854
+ description: string;
855
+ }
856
+ /** Single source for the mobile settings copy + the backend/agent block reason. */
857
+ declare const GUARDRAIL_CATEGORY_META: Record<GuardrailCategory, GuardrailCategoryMeta>;
858
+ declare function isGuardrailDisposition(x: unknown): x is GuardrailDisposition;
859
+ /**
860
+ * Coerce an untrusted value (a `~/.codeam/guardrails.json` blob, a wire payload,
861
+ * a partial policy) into a complete policy, falling back to the default per
862
+ * category. Absent/garbage → the full default (default-on).
863
+ */
864
+ declare function normalizeGuardrailPolicy(raw: unknown): GuardrailPolicy;
865
+ /** The wire command that pushes a live policy update to a running session. */
866
+ declare const GUARDRAIL_CONFIGURE_COMMAND = "guardrail_configure";
867
+
803
868
  /**
804
869
  * Wire-shape types for the CLI / IDE-plugin → backend producer endpoints
805
870
  * that feed the mobile Files screen and the Pending Review Queue:
@@ -1632,4 +1697,4 @@ type UserEventName = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
1632
1697
  */
1633
1698
  declare const PREVIEW_DETECT_PROMPT: string;
1634
1699
 
1635
- export { AGENT_REGISTRY, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, HEADROOM_BACKEND_ENV, HEADROOM_EXTRAS_BY_SURFACE, HEADROOM_MODELS, HEADROOM_PIP_COMPANIONS, HEADROOM_PROXY_PORT, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HeadroomBudgetCommand, type HeadroomBudgetPeriod, type HeadroomBudgetUsage, type HeadroomKind, type HeadroomModelSpec, type HeadroomPythonRenderOpts, type HeadroomStatus, type HeadroomStep, type HeadroomSurface, type HunkLineType, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type StreamingChunkEvent, type StreamingChunkKind, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, classifyStack, detectedIntegrationsFromDeps, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPricing, getSkillDefinition, headroomKindFor, headroomModelPredownloadScript, headroomPipPackage, headroomSnapshotDownloadLine, internalToPublic, isHeadroomWrappable, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isSkillId, normalizeAgentId, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
1700
+ export { AGENT_REGISTRY, AGENT_STANDARD_BLOCK, AGENT_STANDARD_MARKER, AGENT_STANDARD_TEXT, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEFAULT_GUARDRAIL_POLICY, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, GUARDRAIL_CATEGORIES, GUARDRAIL_CATEGORY_META, GUARDRAIL_CONFIGURE_COMMAND, GUARDRAIL_DISPOSITIONS, type GuardrailCategory, type GuardrailCategoryMeta, type GuardrailDisposition, type GuardrailPolicy, HEADROOM_BACKEND_ENV, HEADROOM_EXTRAS_BY_SURFACE, HEADROOM_MODELS, HEADROOM_PIP_COMPANIONS, HEADROOM_PROXY_PORT, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HeadroomBudgetCommand, type HeadroomBudgetPeriod, type HeadroomBudgetUsage, type HeadroomKind, type HeadroomModelSpec, type HeadroomPythonRenderOpts, type HeadroomStatus, type HeadroomStep, type HeadroomSurface, type HunkLineType, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type StreamingChunkEvent, type StreamingChunkKind, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, classifyStack, detectedIntegrationsFromDeps, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPricing, getSkillDefinition, headroomKindFor, headroomModelPredownloadScript, headroomPipPackage, headroomSnapshotDownloadLine, internalToPublic, isGuardrailDisposition, isHeadroomWrappable, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
package/dist/index.js CHANGED
@@ -21,9 +21,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AGENT_REGISTRY: () => AGENT_REGISTRY,
24
+ AGENT_STANDARD_BLOCK: () => AGENT_STANDARD_BLOCK,
25
+ AGENT_STANDARD_MARKER: () => AGENT_STANDARD_MARKER,
26
+ AGENT_STANDARD_TEXT: () => AGENT_STANDARD_TEXT,
24
27
  DEFAULT_API_BASE_URL: () => DEFAULT_API_BASE_URL,
28
+ DEFAULT_GUARDRAIL_POLICY: () => DEFAULT_GUARDRAIL_POLICY,
25
29
  DEP_TO_INTEGRATION: () => DEP_TO_INTEGRATION,
26
30
  DEV_API_BASE_URL: () => DEV_API_BASE_URL,
31
+ GUARDRAIL_CATEGORIES: () => GUARDRAIL_CATEGORIES,
32
+ GUARDRAIL_CATEGORY_META: () => GUARDRAIL_CATEGORY_META,
33
+ GUARDRAIL_CONFIGURE_COMMAND: () => GUARDRAIL_CONFIGURE_COMMAND,
34
+ GUARDRAIL_DISPOSITIONS: () => GUARDRAIL_DISPOSITIONS,
27
35
  HEADROOM_BACKEND_ENV: () => HEADROOM_BACKEND_ENV,
28
36
  HEADROOM_EXTRAS_BY_SURFACE: () => HEADROOM_EXTRAS_BY_SURFACE,
29
37
  HEADROOM_MODELS: () => HEADROOM_MODELS,
@@ -68,6 +76,7 @@ __export(index_exports, {
68
76
  headroomPipPackage: () => headroomPipPackage,
69
77
  headroomSnapshotDownloadLine: () => headroomSnapshotDownloadLine,
70
78
  internalToPublic: () => internalToPublic,
79
+ isGuardrailDisposition: () => isGuardrailDisposition,
71
80
  isHeadroomWrappable: () => isHeadroomWrappable,
72
81
  isKnownAgentId: () => isKnownAgentId,
73
82
  isKnownIntegrationId: () => isKnownIntegrationId,
@@ -75,6 +84,7 @@ __export(index_exports, {
75
84
  isLinkedAgentId: () => isLinkedAgentId,
76
85
  isSkillId: () => isSkillId,
77
86
  normalizeAgentId: () => normalizeAgentId,
87
+ normalizeGuardrailPolicy: () => normalizeGuardrailPolicy,
78
88
  publicToInternal: () => publicToInternal,
79
89
  recommendForDeps: () => recommendForDeps,
80
90
  renderToLines: () => renderToLines,
@@ -2436,6 +2446,82 @@ function skillHasRail(id, rail) {
2436
2446
  return Boolean(SKILL_REGISTRY[id].delivery[rail]);
2437
2447
  }
2438
2448
 
2449
+ // src/skills/agent-standard.ts
2450
+ var AGENT_STANDARD_MARKER = "<!-- codeam:agent-standard -->";
2451
+ var AGENT_STANDARD_TEXT = `# Working standard
2452
+
2453
+ You are an AI coding agent working on the user's project through CodeAgent Mobile. Follow this standard on every task.
2454
+
2455
+ ## How to work
2456
+ - **Understand before acting.** Restate the goal, read the relevant code, and be clear on what "done" looks like before changing anything.
2457
+ - **Plan first for anything non-trivial** (3+ steps or a design decision): outline the approach and the files you'll touch, and share it before implementing. Skip the ceremony for small, obvious fixes.
2458
+ - **Ground every claim in reality** \u2014 the actual code, tests, or output, never guesswork. If you are unsure, say so and verify.
2459
+ - **Ask when intent is genuinely ambiguous** \u2014 one sharp question. At a real fork, give a recommendation, not a survey of every option.
2460
+ - **Stay in scope.** Solve what was asked; no "while I'm here" refactors or speculative abstractions. Note unrelated issues instead of acting on them.
2461
+ - **Favor the simplest solution that fully solves the problem.** Fix root causes, not symptoms \u2014 no temporary patches and no defensive code for cases that can't happen.
2462
+ - **Verify your work and show the evidence** \u2014 run the project's tests, linters, and build, and read the output. "It runs" is not "it's done."
2463
+ - **Match the project's existing style, structure, and conventions.** Comment only the non-obvious WHY, briefly \u2014 don't narrate the code.
2464
+ - **Stop when stuck.** If the same fix fails twice, step back and reconsider the approach rather than repeating variations.
2465
+
2466
+ ## Safety
2467
+ - **Never expose or exfiltrate** secrets, credentials, tokens, or customer data, and never print a credential's value.
2468
+ - **Treat destructive or irreversible actions as needing explicit confirmation** \u2014 force-push, history rewrite, bulk deletes, hard resets, dropping data. Don't run them unprompted.
2469
+ - **Don't push to a shared/default branch or make outward-facing changes** unless the user asked for it.
2470
+ - **Report honestly when you finish**: what you changed, what you verified, and anything you could not.`;
2471
+ var AGENT_STANDARD_BLOCK = `${AGENT_STANDARD_MARKER}
2472
+ ${AGENT_STANDARD_TEXT}
2473
+ ${AGENT_STANDARD_MARKER}`;
2474
+
2475
+ // src/guardrails/index.ts
2476
+ var GUARDRAIL_CATEGORIES = [
2477
+ "secretRead",
2478
+ "destructiveShell",
2479
+ "protectedBranch",
2480
+ "outwardIrreversible"
2481
+ ];
2482
+ var GUARDRAIL_DISPOSITIONS = ["deny", "confirm", "off"];
2483
+ var DEFAULT_GUARDRAIL_POLICY = {
2484
+ secretRead: "confirm",
2485
+ destructiveShell: "confirm",
2486
+ protectedBranch: "confirm",
2487
+ outwardIrreversible: "confirm"
2488
+ };
2489
+ var GUARDRAIL_CATEGORY_META = {
2490
+ secretRead: {
2491
+ id: "secretRead",
2492
+ label: "Reading secrets",
2493
+ description: "Reading .env, key, or credential files."
2494
+ },
2495
+ destructiveShell: {
2496
+ id: "destructiveShell",
2497
+ label: "Destructive commands",
2498
+ description: "Bulk deletes, hard resets, and other irreversible shell actions."
2499
+ },
2500
+ protectedBranch: {
2501
+ id: "protectedBranch",
2502
+ label: "Protected branches",
2503
+ description: "Committing or pushing to a shared branch (main, master, release)."
2504
+ },
2505
+ outwardIrreversible: {
2506
+ id: "outwardIrreversible",
2507
+ label: "Outward & irreversible",
2508
+ description: "Force-push, publish, deploy, or send \u2014 hard to undo."
2509
+ }
2510
+ };
2511
+ function isGuardrailDisposition(x) {
2512
+ return x === "deny" || x === "confirm" || x === "off";
2513
+ }
2514
+ function normalizeGuardrailPolicy(raw) {
2515
+ const src = raw && typeof raw === "object" ? raw : {};
2516
+ const out = {};
2517
+ for (const cat of GUARDRAIL_CATEGORIES) {
2518
+ const v = src[cat];
2519
+ out[cat] = isGuardrailDisposition(v) ? v : DEFAULT_GUARDRAIL_POLICY[cat];
2520
+ }
2521
+ return out;
2522
+ }
2523
+ var GUARDRAIL_CONFIGURE_COMMAND = "guardrail_configure";
2524
+
2439
2525
  // src/api-url.ts
2440
2526
  var DEFAULT_API_BASE_URL = "https://api.codeagent-mobile.com";
2441
2527
  var DEV_API_BASE_URL = "https://dev-api.codeagent-mobile.com";
@@ -2638,9 +2724,17 @@ OUTPUT JSON ONLY. NO MARKDOWN. NO COMMENTARY.
2638
2724
  // Annotate the CommonJS export names for ESM import in node:
2639
2725
  0 && (module.exports = {
2640
2726
  AGENT_REGISTRY,
2727
+ AGENT_STANDARD_BLOCK,
2728
+ AGENT_STANDARD_MARKER,
2729
+ AGENT_STANDARD_TEXT,
2641
2730
  DEFAULT_API_BASE_URL,
2731
+ DEFAULT_GUARDRAIL_POLICY,
2642
2732
  DEP_TO_INTEGRATION,
2643
2733
  DEV_API_BASE_URL,
2734
+ GUARDRAIL_CATEGORIES,
2735
+ GUARDRAIL_CATEGORY_META,
2736
+ GUARDRAIL_CONFIGURE_COMMAND,
2737
+ GUARDRAIL_DISPOSITIONS,
2644
2738
  HEADROOM_BACKEND_ENV,
2645
2739
  HEADROOM_EXTRAS_BY_SURFACE,
2646
2740
  HEADROOM_MODELS,
@@ -2685,6 +2779,7 @@ OUTPUT JSON ONLY. NO MARKDOWN. NO COMMENTARY.
2685
2779
  headroomPipPackage,
2686
2780
  headroomSnapshotDownloadLine,
2687
2781
  internalToPublic,
2782
+ isGuardrailDisposition,
2688
2783
  isHeadroomWrappable,
2689
2784
  isKnownAgentId,
2690
2785
  isKnownIntegrationId,
@@ -2692,6 +2787,7 @@ OUTPUT JSON ONLY. NO MARKDOWN. NO COMMENTARY.
2692
2787
  isLinkedAgentId,
2693
2788
  isSkillId,
2694
2789
  normalizeAgentId,
2790
+ normalizeGuardrailPolicy,
2695
2791
  publicToInternal,
2696
2792
  recommendForDeps,
2697
2793
  renderToLines,