@tangle-network/agent-app 0.16.1 → 0.19.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.
@@ -0,0 +1,136 @@
1
+ import { AgentProfileFileMount } from '@tangle-network/sandbox';
2
+
3
+ /**
4
+ * Unified skill + corpus mounter for agent products.
5
+ *
6
+ * Every agent product hand-rolls the same two file-mount systems and then
7
+ * drifts on the seams between them. (1) An ALWAYS-MOUNTED markdown corpus —
8
+ * (`skills/<slug>/SKILL.md`, `doctrine` and `knowledge` markdown trees) — discovered
9
+ * by a Vite `?raw` glob in the Worker bundle and by Node `fs` under the eval
10
+ * CLI, then projected into `resources.files`. (2) A TIER-GATED installable
11
+ * registry — a hand-authored array of `SkillEntry` whose free tier mounts at
12
+ * the harness skill-discovery path and whose paid tier is installed on demand.
13
+ * Both ride the same `resources.files` channel but use different provenance
14
+ * (file-backed vs inline), different mount paths (relative corpus path vs
15
+ * `~/.claude/skills/<id>/SKILL.md`), and different selection rules. This module
16
+ * makes both DATA: a corpus loader that accepts a Vite glob-result map (or an
17
+ * fs fallback), a registry adapter that tier-gates, and a single
18
+ * `composeShellResources` that projects either onto the SDK file-mount shape.
19
+ *
20
+ * Substrate-free over storage, exact over the SDK boundary: the only inbound
21
+ * seam is the glob-result map the consumer passes in (its call site keeps the
22
+ * literal `import.meta.glob` Vite must static-analyze); the only outbound seam
23
+ * is `@tangle-network/sandbox`'s `AgentProfileFileMount[]`, the exact shape the
24
+ * agent profile's `resources.files` consumes. Node builtins are resolved lazily
25
+ * via `process.getBuiltinModule` so a static `node:*` import never reaches the
26
+ * Vite SSR bundle.
27
+ */
28
+
29
+ /** A Vite eager `?raw` glob result: glob key -> raw file body. The consumer
30
+ * produces this by calling `import.meta.glob('<lit>', { eager: true, query:
31
+ * '?raw', import: 'default' })` at its own call site — the literal must stay
32
+ * literal so Vite can static-analyze it; passing the result here keeps that
33
+ * constraint at the edge and the loader substrate-free. */
34
+ type GlobModules = Record<string, string>;
35
+ /** One markdown document discovered from the corpus. */
36
+ interface CorpusEntry {
37
+ /** Slug derived from the glob key (folder slug for `SKILL.md` layouts, or the
38
+ * normalized relative path for flat `*.md` layouts). */
39
+ id: string;
40
+ /** Glob/fs key the entry was loaded from, normalized to a stable relative
41
+ * form (leading `./` and absolute prefixes stripped). */
42
+ key: string;
43
+ /** Raw markdown body (including any frontmatter). */
44
+ content: string;
45
+ }
46
+ /** A hand-authored, tier-gated installable skill. Mirrors the per-product
47
+ * registry entry (gtm/insurance `SkillEntry`); the runtime's certified `skill`
48
+ * artifact kind is unrelated. `skillMd` is the inline body — file provenance
49
+ * does not apply to the registry. */
50
+ interface SkillEntry {
51
+ id: string;
52
+ name: string;
53
+ description: string;
54
+ author?: {
55
+ name: string;
56
+ url?: string;
57
+ };
58
+ source?: string;
59
+ category?: string;
60
+ tags?: string[];
61
+ /** Gate keyword. `composeShellResources`/`registrySkills` treat `free` as
62
+ * always-mounted; everything else is install-on-demand. */
63
+ tier: string;
64
+ skillMd: string;
65
+ }
66
+ /** Harness skill-discovery path the Claude Code / OpenCode backend reads
67
+ * natively. The registry mounts here; the corpus mounts at its relative path. */
68
+ declare function skillMountPath(id: string): string;
69
+ /** Options for {@link loadMarkdownCorpus}. */
70
+ interface LoadCorpusOptions {
71
+ /** The anchor folder name that appears in both glob keys and fs paths
72
+ * (`skills`, `doctrine`, `knowledge`). Used to normalize keys + derive ids. */
73
+ anchor: string;
74
+ /** Vite glob-result map. When present and non-empty it is authoritative and
75
+ * the fs path is skipped. Omit it (or pass an empty map) only outside Vite. */
76
+ globModules?: GlobModules;
77
+ /** Absolute or `import.meta.url`-relative base dir the fs fallback walks when
78
+ * `globModules` is empty. Required for the fs path to run; without it the fs
79
+ * fallback returns no entries (Workers never need it). */
80
+ fsBaseDir?: string;
81
+ /** Walk strategy for the fs fallback. `nested` finds `<dir>/<slug>/SKILL.md`
82
+ * one level deep; `flat` recurses for every `*.md`. Default: `flat`. */
83
+ fsLayout?: 'nested' | 'flat';
84
+ /** Drop an entry by its normalized key after load. Covers the per-product
85
+ * skip lists (corpus index/log files, scaffold templates, allow-lists). */
86
+ skip?: (normalizedKey: string) => boolean;
87
+ }
88
+ /** Outcome of {@link loadMarkdownCorpus}: the entries plus which path produced
89
+ * them, so a caller can fail loud when both are empty rather than silently
90
+ * mounting nothing. */
91
+ interface CorpusLoadResult {
92
+ source: 'vite' | 'fs' | 'empty';
93
+ entries: CorpusEntry[];
94
+ }
95
+ /**
96
+ * Load a markdown corpus, preferring a Vite glob-result map and falling back to
97
+ * a Node fs walk. Selection is by non-empty glob result — never an env flag.
98
+ * Entries are normalized, optionally skip-filtered, and sorted by id for
99
+ * determinism. The `import.meta.glob` literal stays at the CONSUMER call site
100
+ * (passed in as `globModules`); this loader never constructs a glob.
101
+ */
102
+ declare function loadMarkdownCorpus(options: LoadCorpusOptions, importMetaUrl?: string): CorpusLoadResult;
103
+ /** Project corpus entries onto SDK file mounts at a relative path under
104
+ * `<anchor>/`. Always-mounted: the corpus is the agent's baseline knowledge. */
105
+ declare function corpusSkills(corpus: CorpusEntry[], anchor: string): AgentProfileFileMount[];
106
+ /** Project the registry's free-tier (or `tier`-matched) entries onto SDK file
107
+ * mounts at the harness skill-discovery path. Tier-gating is the registry's
108
+ * only selection rule — paid skills are installed on demand, not at boot. */
109
+ declare function registrySkills(registry: SkillEntry[], tier?: string): AgentProfileFileMount[];
110
+ /** Inputs to {@link composeShellResources}. Each channel is optional so a
111
+ * product mounts only the systems it has — corpus-only, registry-only, or
112
+ * both — without conflating them. */
113
+ interface ComposeShellResourcesInput {
114
+ /** Corpus mounts (always-mounted baseline). Pass the result of
115
+ * {@link corpusSkills}, or a hand-built mount list. */
116
+ skills?: AgentProfileFileMount[];
117
+ /** Knowledge-corpus mounts (a second always-mounted corpus, e.g. a domain
118
+ * knowledge pack distinct from the skills corpus). */
119
+ knowledge?: AgentProfileFileMount[];
120
+ /** Evolvable / learned-guidance mounts (single-file corpora). */
121
+ evolvable?: AgentProfileFileMount[];
122
+ /** Registry mounts (tier-gated). Pass the result of {@link registrySkills}. */
123
+ registry?: AgentProfileFileMount[];
124
+ /** Final skip filter applied to the composed mount list by mount `path`. */
125
+ predicate?: (mount: AgentProfileFileMount) => boolean;
126
+ }
127
+ /**
128
+ * Compose every mount channel into one `resources.files`-ready array. Corpus
129
+ * channels come first (baseline), the tier-gated registry last (so a registry
130
+ * entry can override a corpus entry that mounts at the same path). The result
131
+ * is exactly `AgentProfileFileMount[]` — assign it straight into
132
+ * `profile.resources.files` with no cast.
133
+ */
134
+ declare function composeShellResources(input: ComposeShellResourcesInput): AgentProfileFileMount[];
135
+
136
+ export { type ComposeShellResourcesInput, type CorpusEntry, type CorpusLoadResult, type GlobModules, type LoadCorpusOptions, type SkillEntry, composeShellResources, corpusSkills, loadMarkdownCorpus, registrySkills, skillMountPath };
@@ -0,0 +1,15 @@
1
+ import {
2
+ composeShellResources,
3
+ corpusSkills,
4
+ loadMarkdownCorpus,
5
+ registrySkills,
6
+ skillMountPath
7
+ } from "../chunk-KOG473C4.js";
8
+ export {
9
+ composeShellResources,
10
+ corpusSkills,
11
+ loadMarkdownCorpus,
12
+ registrySkills,
13
+ skillMountPath
14
+ };
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,7 +1,8 @@
1
- import { b as AppToolName, f as ToolHeaderNames } from '../mcp-eZCmkgCF.js';
2
- export { A as APP_TOOL_NAMES, a as AppToolMcpServer, c as AuthenticateOptions, B as BuildHttpMcpServerOptions, d as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, e as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, g as authenticateToolRequest, h as buildAppToolMcpServer, i as buildAppToolOpenAITools, j as buildHttpMcpServer, k as isAppToolName, r as readToolArgs } from '../mcp-eZCmkgCF.js';
1
+ import { a as AppToolName, c as ToolHeaderNames } from '../auth-BlS9GWfL.js';
2
+ export { A as APP_TOOL_NAMES, b as AuthenticateOptions, D as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, d as authenticateToolRequest, e as buildAppToolOpenAITools, i as isAppToolName, r as readToolArgs } from '../auth-BlS9GWfL.js';
3
3
  import { f as AppToolTaxonomy, c as AppToolHandlers, b as AppToolContext, e as AppToolProducedEvent, d as AppToolOutcome } from '../types-2rOJo8Hc.js';
4
4
  export { A as AddCitationArgs, a as AddCitationResult, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from '../types-2rOJo8Hc.js';
5
+ export { A as AppToolMcpServer, B as BuildHttpMcpServerOptions, a as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, b as buildAppToolMcpServer, c as buildHttpMcpServer } from '../mcp-BShTlESm.js';
5
6
  export { C as CreateMcpToolHandlerOptions, M as MCP_PROTOCOL_VERSIONS, a as McpProtocolVersion, b as McpServerInfo, c as McpToolDefinition, d as createMcpToolHandler } from '../mcp-rpc-DLw_r9PQ.js';
6
7
 
7
8
  /** A correctable bad-input error a tool handler throws; the HTTP layer maps it
@@ -197,6 +197,42 @@ interface AgentActivityPanelProps {
197
197
  */
198
198
  declare function AgentActivityPanel({ fetchActivity, renderMissionRef, title, emptyLabel }: AgentActivityPanelProps): react.JSX.Element;
199
199
 
200
+ /**
201
+ * `SeatPaywall` — the shared "unlock this product" screen every agent app
202
+ * shows when a user has no active seat and has spent past the free tier. One
203
+ * component, adopted by all five products (gtm / creative / tax / legal /
204
+ * insurance) in ~2 lines.
205
+ *
206
+ * Copy contract (design §6.8): the included monthly AI usage is framed as a
207
+ * BENEFIT the buyer receives — never the ratio, never the word "margin", never
208
+ * "we debit 50%". Surface the allowance, hide the economics.
209
+ *
210
+ * Styling contract matches the rest of `web-react`: Tailwind classes over the
211
+ * shared design tokens (`bg-card`, `border-border`, `text-muted-foreground`,
212
+ * `bg-primary`, …); glyphs are inline SVGs; no icon or UI library.
213
+ */
214
+
215
+ interface SeatPaywallProps {
216
+ /** Human product name shown in the headline, e.g. "Creative". */
217
+ product: string;
218
+ /** Fired when the user clicks the unlock CTA — route them to checkout. */
219
+ onCheckout: () => void;
220
+ /** Monthly seat price in whole dollars. Default 100. */
221
+ priceUsd?: number;
222
+ /** Included monthly AI usage in whole dollars. Default 50. */
223
+ includedUsageUsd?: number;
224
+ /** Optional one-line value prop under the headline. */
225
+ tagline?: string;
226
+ /** CTA label. Default "Unlock {product}". */
227
+ ctaLabel?: string;
228
+ }
229
+ /**
230
+ * Centered card paywall. The price line reads
231
+ * "$100/mo · includes $50/mo of AI usage" so the included allowance anchors the
232
+ * value without ever exposing the ratio.
233
+ */
234
+ declare function SeatPaywall({ product, onCheckout, priceUsd, includedUsageUsd, tagline, ctaLabel, }: SeatPaywallProps): ReactNode;
235
+
200
236
  interface ChatMessageMetrics {
201
237
  modelUsed?: string;
202
238
  promptTokens?: number;
@@ -317,4 +353,4 @@ type ToolDetailRenderers = Record<string, (call: ChatToolCallInfo, message: Chat
317
353
  */
318
354
  declare function ChatMessages({ messages, models, renderMarkdown, renderExtras, userLabel, agentLabel, loading, approval, onToolCallClick, toolRenderers, }: ChatMessagesProps): react.JSX.Element;
319
355
 
320
- export { type ActivityTone, type AgentActivityPage, AgentActivityPanel, type AgentActivityPanelProps, type AgentActivityRecord, type ChatMessageMetrics, ChatMessages, type ChatMessagesProps, type ChatStreamCallbacks, type ChatStreamToolCall, type ChatStreamToolResult, type ChatToolCallInfo, type ChatUiMessage, type ConsumeChatStreamResult, EffortPicker, type EffortPickerProps, FlowWaterfall, type FlowWaterfallProps, MissionActivityLane, type MissionActivityLaneProps, ModelPicker, type ModelPickerProps, type ProposalApprovalHandlers, ProviderLogo, type ProviderLogoProps, RunDrillIn, type RunDrillInProps, type SmoothRevealOptions, type StreamChatOptions, type ToolDetailRenderers, type ToolRunRecord, type ToolRunStep, type WaterfallRow, activityTone, consumeChatStream, dispatchChatStreamLine, formatActivityCost, formatActivityDuration, formatModelCost, formatTokensPerSecond, mergeActivityPages, nextRevealCount, pendingApprovalOf, streamChatTurn, useSmoothText, waterfallLayout };
356
+ export { type ActivityTone, type AgentActivityPage, AgentActivityPanel, type AgentActivityPanelProps, type AgentActivityRecord, type ChatMessageMetrics, ChatMessages, type ChatMessagesProps, type ChatStreamCallbacks, type ChatStreamToolCall, type ChatStreamToolResult, type ChatToolCallInfo, type ChatUiMessage, type ConsumeChatStreamResult, EffortPicker, type EffortPickerProps, FlowWaterfall, type FlowWaterfallProps, MissionActivityLane, type MissionActivityLaneProps, ModelPicker, type ModelPickerProps, type ProposalApprovalHandlers, ProviderLogo, type ProviderLogoProps, RunDrillIn, type RunDrillInProps, SeatPaywall, type SeatPaywallProps, type SmoothRevealOptions, type StreamChatOptions, type ToolDetailRenderers, type ToolRunRecord, type ToolRunStep, type WaterfallRow, activityTone, consumeChatStream, dispatchChatStreamLine, formatActivityCost, formatActivityDuration, formatModelCost, formatTokensPerSecond, mergeActivityPages, nextRevealCount, pendingApprovalOf, streamChatTurn, useSmoothText, waterfallLayout };