@tealbrick/kit 0.3.0-rc.1 → 0.3.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/BOOTSTRAP.md +9 -10
  2. package/BUZZ.md +146 -0
  3. package/NATIVE.md +10 -4
  4. package/README.md +263 -2
  5. package/RUNTIME.md +1 -1
  6. package/assets/buzz/buzz-backend-provider.py +99 -0
  7. package/assets/buzz/buzz-plist.py +22 -0
  8. package/assets/buzz/buzz-run.sh +39 -0
  9. package/assets/buzz/tb-provider-apply.py +97 -0
  10. package/dist/buzz.d.ts +63 -0
  11. package/dist/buzz.js +262 -0
  12. package/dist/cli.js +9 -4
  13. package/dist/index.d.ts +15 -14
  14. package/dist/index.js +1 -1
  15. package/dist/native-acp.d.ts +40 -0
  16. package/dist/native-acp.js +224 -0
  17. package/dist/native-app-capabilities.d.ts +33 -0
  18. package/dist/native-app-capabilities.js +37 -0
  19. package/dist/native-buzz.d.ts +161 -0
  20. package/dist/native-buzz.js +649 -0
  21. package/dist/native-child-guard.js +7 -2
  22. package/dist/native-claude.d.ts +99 -0
  23. package/dist/native-claude.js +584 -0
  24. package/dist/native-enroll.d.ts +22 -0
  25. package/dist/native-enroll.js +85 -0
  26. package/dist/native-runtime-sync.d.ts +49 -0
  27. package/dist/native-runtime-sync.js +101 -0
  28. package/dist/native-selection.js +19 -4
  29. package/dist/native-serve-config.d.ts +286 -0
  30. package/dist/native-serve-config.js +296 -0
  31. package/dist/native-serve.d.ts +76 -0
  32. package/dist/native-serve.js +145 -0
  33. package/dist/native-setup.js +38 -15
  34. package/dist/native-standing-grants.d.ts +105 -0
  35. package/dist/native-standing-grants.js +226 -0
  36. package/dist/native.d.ts +3 -0
  37. package/dist/native.js +94 -5
  38. package/dist/onboarding.d.ts +8 -0
  39. package/dist/onboarding.js +9 -2
  40. package/dist/runtime-onboarding.js +2 -2
  41. package/dist/secrets.d.ts +2 -1
  42. package/dist/secrets.js +4 -2
  43. package/package.json +9 -7
@@ -0,0 +1,99 @@
1
+ import type { AccessMode, HarnessAdapter } from '@tealbrick/portal/native-bridge';
2
+ import { type ClaudeAttachment, type ClaudeProfile } from './native-serve-config.js';
3
+ import { type GrantUsageStore } from './native-standing-grants.js';
4
+ /** Minimal structural view of @anthropic-ai/claude-agent-sdk (validated against 0.3.287). */
5
+ export interface ClaudeQuery extends AsyncIterable<any> {
6
+ interrupt?(): Promise<unknown>;
7
+ close?(): void;
8
+ accountInfo?(): Promise<any>;
9
+ }
10
+ export interface ClaudeSdk {
11
+ query(params: {
12
+ prompt: AsyncIterable<any>;
13
+ options: Record<string, any>;
14
+ }): ClaudeQuery;
15
+ getSessionInfo?(sessionId: string, options?: {
16
+ dir?: string;
17
+ }): Promise<unknown>;
18
+ /** In-process MCP servers (SDK `createSdkMcpServer` / `tool`). */
19
+ createSdkMcpServer?(options: {
20
+ name: string;
21
+ version?: string;
22
+ tools?: unknown[];
23
+ }): unknown;
24
+ tool?(name: string, description: string, inputSchema: Record<string, unknown>, handler: (args: any, extra: unknown) => Promise<any>): unknown;
25
+ }
26
+ export declare function loadClaudeSdk(root: string, sdkModule?: string): Promise<ClaudeSdk>;
27
+ /** `sandbox`: the owner's sandboxed workspace session (Restricted mode when `claude.workspace` is configured). */
28
+ export type ClaudeAccess = {
29
+ mode: AccessMode;
30
+ revision: number;
31
+ tools: string[];
32
+ sandbox?: boolean;
33
+ };
34
+ /** Built-in tools Restricted mode exposes: read-only and contained to the workspace. */
35
+ export declare const readOnlyTools: string[];
36
+ export declare const workspaceTools: string[];
37
+ /** Claude Code's per-cwd temp folder name: every non-alphanumeric character becomes '-'. */
38
+ export declare const claudeTmpSlug: (dir: string) => string;
39
+ /** Claude Code's sandbox temp roots for this OS user (sandboxed Bash TMPDIR), shared by every session of the user. */
40
+ export declare const claudeTmpRoots: (uid: number) => string[];
41
+ /** In-process (unsandboxed) filesystem tools: never available in the sandboxed workspace session, owner or expert. */
42
+ export declare const unsandboxedFileTools: string[];
43
+ /** Homebrew prefixes the sandboxed shell keeps reading (only those present are listed). Never the whole /opt/homebrew. */
44
+ export declare const homebrewReadRoots: string[];
45
+ /** Removed from the model's context unless a wider access mode explicitly lists them. */
46
+ export declare const restrictedDenied: string[];
47
+ /** Chat-relay identity secrets: never forwarded to the SDK process, even if listed in envPassthrough. */
48
+ export declare const neverForwardedEnv: string[];
49
+ /** WebFetch targets the workspace session may not reach: non-http(s), loopback/private/link-local/CGNAT IPs and local names. */
50
+ export declare function privateWebTarget(raw: unknown): string | undefined;
51
+ /** What a Portal registration id refers to; resolved from the runtime's own capability snapshot. */
52
+ export type AppRef = {
53
+ appId: string;
54
+ plugin?: string;
55
+ action?: string;
56
+ };
57
+ export interface ToolPolicy {
58
+ access: ClaudeAccess;
59
+ profile: ClaudeProfile;
60
+ protectedPaths: string[];
61
+ resolveApp?: (registrationId: string) => Promise<AppRef | undefined>;
62
+ /** Exact in-process MCP tool names for the owner session only (never expert subagents), without payload approval. */
63
+ ownerTools?: string[];
64
+ }
65
+ /** Contract experts that may reach the owner's Teal Brick connector (still bounded per call by decideTool). */
66
+ export declare const contractsWithAppAccess: (profile: ClaudeProfile) => string[];
67
+ /** Payload-bound approval: owner-wide approval operations, plus a contract's own list and any outward write by a contract expert. */
68
+ export declare function needsApproval(profile: ClaudeProfile, name: string, input: Record<string, unknown>, agentType?: string): boolean;
69
+ /** Single decision point for PreToolUse hooks and canUseTool. Names and decisions only are logged. */
70
+ export declare function decideTool(policy: ToolPolicy, name: string, input: Record<string, unknown>, agentId?: string, agentType?: string): Promise<{
71
+ allow: boolean;
72
+ reason: string;
73
+ }>;
74
+ export interface ClaudeHarnessOptions {
75
+ name: string;
76
+ profile: ClaudeProfile;
77
+ attachment: ClaudeAttachment;
78
+ sdk: ClaudeSdk;
79
+ protectedPaths: string[];
80
+ log?: (event: Record<string, unknown>) => void;
81
+ env?: NodeJS.ProcessEnv;
82
+ /** Resolves registration ids to apps for contract scope checks. */
83
+ resolveApp?: (registrationId: string) => Promise<AppRef | undefined>;
84
+ /** Owner-only directory for per-run delegation trace records (JSONL). */
85
+ traceDir?: string;
86
+ /** How long a payload approval may wait before it is denied. */
87
+ approvalTimeoutMs?: number;
88
+ /** Owner-session in-process MCP servers, created per turn (an SDK server instance serves one query). */
89
+ extraMcpServers?: (sessionId: string) => Record<string, unknown>;
90
+ /** Exact `mcp__<server>__<tool>` names from extraMcpServers allowed for the owner session only. */
91
+ extraTools?: string[];
92
+ /** Appended to the owner session's system prompt. */
93
+ systemNote?: string;
94
+ /** Usage counters for claude.standingGrants (shared by native serve and acp); in-memory when omitted. */
95
+ standingGrants?: GrantUsageStore;
96
+ }
97
+ /** Claude Agent SDK adapter. Claude's persisted session transcript is the source of truth;
98
+ * every turn is a fresh query() that resumes the same session id. */
99
+ export declare function claudeHarness(options: ClaudeHarnessOptions): HarnessAdapter<ClaudeAccess>;