@percena/weft 0.4.0-next.0 → 0.4.0-next.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 (114) hide show
  1. package/dist/action-bridge.cjs +323 -0
  2. package/dist/action-bridge.d.cts +8 -0
  3. package/dist/action-bridge.d.ts +8 -0
  4. package/dist/action-bridge.js +291 -0
  5. package/dist/chat.cjs +3851 -36
  6. package/dist/chat.d.cts +1 -874
  7. package/dist/chat.d.ts +1 -874
  8. package/dist/chat.js +3870 -36
  9. package/dist/index.cjs +12085 -1488
  10. package/dist/index.d.cts +553 -240
  11. package/dist/index.d.ts +553 -240
  12. package/dist/index.js +12118 -1447
  13. package/dist/providers-flitro.cjs +50 -307
  14. package/dist/providers-flitro.d.cts +75 -52
  15. package/dist/providers-flitro.d.ts +75 -52
  16. package/dist/providers-flitro.js +45 -287
  17. package/dist/styles/fonts/KaTeX_AMS-Regular.ttf +0 -0
  18. package/dist/styles/fonts/KaTeX_AMS-Regular.woff +0 -0
  19. package/dist/styles/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  20. package/dist/styles/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  21. package/dist/styles/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  22. package/dist/styles/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  23. package/dist/styles/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  24. package/dist/styles/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  25. package/dist/styles/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  26. package/dist/styles/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  27. package/dist/styles/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  28. package/dist/styles/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  29. package/dist/styles/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  30. package/dist/styles/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  31. package/dist/styles/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  32. package/dist/styles/fonts/KaTeX_Main-Bold.ttf +0 -0
  33. package/dist/styles/fonts/KaTeX_Main-Bold.woff +0 -0
  34. package/dist/styles/fonts/KaTeX_Main-Bold.woff2 +0 -0
  35. package/dist/styles/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  36. package/dist/styles/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  37. package/dist/styles/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  38. package/dist/styles/fonts/KaTeX_Main-Italic.ttf +0 -0
  39. package/dist/styles/fonts/KaTeX_Main-Italic.woff +0 -0
  40. package/dist/styles/fonts/KaTeX_Main-Italic.woff2 +0 -0
  41. package/dist/styles/fonts/KaTeX_Main-Regular.ttf +0 -0
  42. package/dist/styles/fonts/KaTeX_Main-Regular.woff +0 -0
  43. package/dist/styles/fonts/KaTeX_Main-Regular.woff2 +0 -0
  44. package/dist/styles/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  45. package/dist/styles/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  46. package/dist/styles/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  47. package/dist/styles/fonts/KaTeX_Math-Italic.ttf +0 -0
  48. package/dist/styles/fonts/KaTeX_Math-Italic.woff +0 -0
  49. package/dist/styles/fonts/KaTeX_Math-Italic.woff2 +0 -0
  50. package/dist/styles/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  51. package/dist/styles/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  52. package/dist/styles/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  53. package/dist/styles/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  54. package/dist/styles/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  55. package/dist/styles/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  56. package/dist/styles/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  57. package/dist/styles/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  58. package/dist/styles/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  59. package/dist/styles/fonts/KaTeX_Script-Regular.ttf +0 -0
  60. package/dist/styles/fonts/KaTeX_Script-Regular.woff +0 -0
  61. package/dist/styles/fonts/KaTeX_Script-Regular.woff2 +0 -0
  62. package/dist/styles/fonts/KaTeX_Size1-Regular.ttf +0 -0
  63. package/dist/styles/fonts/KaTeX_Size1-Regular.woff +0 -0
  64. package/dist/styles/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  65. package/dist/styles/fonts/KaTeX_Size2-Regular.ttf +0 -0
  66. package/dist/styles/fonts/KaTeX_Size2-Regular.woff +0 -0
  67. package/dist/styles/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  68. package/dist/styles/fonts/KaTeX_Size3-Regular.ttf +0 -0
  69. package/dist/styles/fonts/KaTeX_Size3-Regular.woff +0 -0
  70. package/dist/styles/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  71. package/dist/styles/fonts/KaTeX_Size4-Regular.ttf +0 -0
  72. package/dist/styles/fonts/KaTeX_Size4-Regular.woff +0 -0
  73. package/dist/styles/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  74. package/dist/styles/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  75. package/dist/styles/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  76. package/dist/styles/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  77. package/dist/styles/index.css +2 -212
  78. package/package.json +23 -49
  79. package/dist/auth.cjs +0 -241
  80. package/dist/auth.d.cts +0 -21
  81. package/dist/auth.d.ts +0 -21
  82. package/dist/auth.js +0 -208
  83. package/dist/automations.cjs +0 -3044
  84. package/dist/automations.d.cts +0 -4774
  85. package/dist/automations.d.ts +0 -4774
  86. package/dist/automations.js +0 -2965
  87. package/dist/factory.cjs +0 -5057
  88. package/dist/factory.d.cts +0 -7909
  89. package/dist/factory.d.ts +0 -7909
  90. package/dist/factory.js +0 -5008
  91. package/dist/local-runtime.cjs +0 -1387
  92. package/dist/local-runtime.d.cts +0 -3314
  93. package/dist/local-runtime.d.ts +0 -3314
  94. package/dist/local-runtime.js +0 -1345
  95. package/dist/providers.cjs +0 -6154
  96. package/dist/providers.d.cts +0 -6024
  97. package/dist/providers.d.ts +0 -6024
  98. package/dist/providers.js +0 -6110
  99. package/dist/server.cjs +0 -9137
  100. package/dist/server.d.cts +0 -9868
  101. package/dist/server.d.ts +0 -9868
  102. package/dist/server.js +0 -9118
  103. package/dist/skills-browser.cjs +0 -118
  104. package/dist/skills-browser.d.cts +0 -105
  105. package/dist/skills-browser.d.ts +0 -105
  106. package/dist/skills-browser.js +0 -88
  107. package/dist/skills.cjs +0 -505
  108. package/dist/skills.d.cts +0 -218
  109. package/dist/skills.d.ts +0 -218
  110. package/dist/skills.js +0 -458
  111. package/dist/sources.cjs +0 -1710
  112. package/dist/sources.d.cts +0 -3978
  113. package/dist/sources.d.ts +0 -3978
  114. package/dist/sources.js +0 -1675
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
- export { AgentCommandSink, AgentEventStream, AgentRuntime, AgentRuntimeKind, AgentRuntimeState, AgentRuntimeStatus, AgentTimelineStream, RuntimeCapabilityReport, RuntimePolicyHook, SessionToolBridge, createRuntimeCapabilityReport, createRuntimeExtensionContext, invokeSessionTool, reduceRuntimeState, sanitizeProviderSourceTools, selectRuntimeCandidate };
2
- export { PermissionApproval, PermissionPolicy, PermissionScope, PolicyDecisionReceipt, PolicyLayer, PolicyRuleMatch, ToolIntent, ToolPolicyDecision, ToolPolicyRequest, createInMemoryApprovalStore, createPermissionPolicy, createPermissionPolicyFromConfig, createPolicyDecisionReceipt, createSourcePolicyLayer, evaluateToolPolicy, explainToolPolicy, validatePolicyConfig };
1
+ export { AgentCommandSink, AgentEventStream, AgentRuntime, AgentRuntimeKind, AgentRuntimeState, AgentRuntimeStatus, AgentTimelineStream, SendMessageOptions };
2
+ export { TimelineCursor, TimelineEnvelope, TimelineFetchRequest, TimelineFetchResult, TimelineItem, TimelinePermissionRequest, TimelinePermissionResolution };
3
+ export { AgentSession, UseAgentSessionOptions, useAgentSession };
4
+ export { CreateFlitroEmbedRuntimeOptions, createFlitroEmbedRuntime };
5
+ export { AgentChatPanel, TimelineAgentChatPanel, useAgentChatSession, useTimelineAgentChatSession };
6
+ export { EN_FALLBACK };
3
7
 
4
8
  // ── inlined from @weft/core ──
5
9
  // -- @weft/core/index.d.ts --
@@ -3092,273 +3096,582 @@ declare function createRuntimeCapabilityReport(options: CreateRuntimeCapabilityR
3092
3096
 
3093
3097
  export { type AgentCommandSink, type AgentEventStream, type AgentRuntime, type AgentRuntimeKind, type AgentRuntimeOptions, type AgentRuntimeState, type AgentRuntimeStatus, type AgentTimelineStream, type BrowserActionReceipt, type BrowserActionRequest, type CodexPermissionParams, type CommandOrigin, type CommandReceipt, type CreateRuntimeCapabilityReportOptions, type CreateSkillRequest, type CreateSkillResult, type CreateSourceRequest, type CreateSourceResult, type DeleteSkillRequest, type DeleteSkillResult, type DeleteSourceRequest, type DeleteSourceResult, type GetAutomationsConfigRequest, type GetAutomationsConfigResult, type GetSkillRequest, type GetSkillResult, type GetSourceRequest, type GetSourceResult, type InterSessionMessageRequest, type InvokeSessionToolOptions, type ListSchedulesRequest, type ListSchedulesResult, type ListSkillsRequest, type ListSkillsResult, type ListSourcesRequest, type ListSourcesResult, type LlmToolRequest, type LlmToolResult, type ProviderAuthDetection, type ProviderAuthMode, type ProviderSourceCredentialRef, type ProviderSourceToolDescriptor, RUNTIME_KINDS, type RuntimeAction, type RuntimeAuthDetection, type RuntimeAutomationCapabilities, type RuntimeCandidate, type RuntimeCapabilityReport, type RuntimeExtensionCapabilities, type RuntimeExtensionContext, type RuntimeFeatureCapabilities, type RuntimeHostServices, type RuntimeHostToolCapabilities, type RuntimePermissionScope, type RuntimePermissionScopeInput, type RuntimePolicyCapabilities, type RuntimePolicyExtension, type RuntimePolicyHook, type RuntimeSelection, type RuntimeSelectionOptions, type RuntimeSkillCapabilities, type RuntimeSourceCapabilities, type RuntimeToolIntent, type ScheduleSummary, type SendMessageOptions, type SessionListRequest, type SessionListResult, type SessionMetadataPatch, type SessionMetadataSnapshot, type SessionToolBridge, type SessionToolInvocationReceipt, type SessionToolName, type SessionToolRequest, type SessionToolTimelineRef, type SkillSelection, type SkillSummary, type SourceActivationReceipt, type SourceActivationRequest, type SourceAuthReceipt, type SourceAuthRequest, type SourceSelection, type SourceSummary, type SpawnSessionReceipt, type SpawnSessionRequest, type StartScheduleRequest, type StartScheduleResult, type StopScheduleRequest, type StopScheduleResult, type SubmitPlanReceipt, type SubmitPlanRequest, type ToolPolicyDecision, type ToolPolicyRequest, type UpdateAutomationsConfigRequest, type UpdateAutomationsConfigResult, type UpdateSkillRequest, type UpdateSkillResult, type UpdateSourceRequest, type UpdateSourceResult, createRuntimeCapabilityReport, createRuntimeExtensionContext, initialRuntimeState, invokeSessionTool, mapCodexSandboxModeToSandboxPolicy, mapPermissionModeToCodexParams, reduceRuntimeState, sanitizeProviderSourceTools, selectRuntimeCandidate };
3094
3098
 
3095
- // ── inlined from @weft/policy ──
3096
- // -- @weft/policy/index.d.ts --
3097
-
3098
- type ToolPolicyDecision = {
3099
- decision: 'allow';
3100
- } | {
3101
- decision: 'ask';
3102
- reason: string;
3103
- } | {
3104
- decision: 'deny';
3105
- reason: string;
3106
- };
3107
- type ToolIntent = {
3108
- kind: 'bash';
3109
- command: string;
3110
- baseCommand: string;
3111
- } | {
3112
- kind: 'file_write';
3113
- path: string;
3114
- toolName: string;
3115
- } | {
3116
- kind: 'mcp';
3117
- name: string;
3118
- } | {
3119
- kind: 'api';
3120
- method: string;
3121
- path: string;
3122
- url?: string;
3123
- } | {
3124
- kind: 'unknown';
3125
- toolName: string;
3126
- };
3127
- interface PolicyRuleMatch {
3128
- layerId: string;
3129
- ruleType: 'bash-pattern' | 'mcp-pattern' | 'api-endpoint' | 'write-path' | 'blocked-command-hint';
3130
- pattern: string;
3131
- }
3132
- type ToolPolicyExplanation = ToolPolicyDecision & {
3133
- intent: ToolIntent;
3134
- matchedRule?: PolicyRuleMatch;
3135
- hint?: string;
3136
- tryInstead?: string[];
3137
- hintContext?: string;
3138
- };
3099
+ // ── inlined from @weft/client ──
3100
+ // -- @weft/client/index.d.ts --
3139
3101
  /**
3140
- * Policy decision receipt — a full audit record for every allow/ask/deny decision.
3102
+ * Structural timeline types.
3141
3103
  *
3142
- * Required by §11.8.2: each policy decision must produce a machine-readable receipt
3143
- * with requestId, matchedRule, scope, origin, ttl, and explain, plus timelineRef
3144
- * for cross-referencing with the canonical timeline.
3104
+ * These mirror `@weft/timeline`'s `TimelineEnvelope` and `@weft/runtime-core`'s
3105
+ * `AgentTimelineStream` so this package stays zero-dependency. TypeScript's
3106
+ * structural typing keeps them interchangeable with the Weft originals: the
3107
+ * `item` payload is left as `unknown` here (the SSE protocol does not constrain
3108
+ * it), and `@weft/provider-flitro` narrows it when bridging into a runtime.
3145
3109
  */
3146
- interface PolicyDecisionReceipt {
3147
- /** Unique request identifier for audit trail */
3148
- requestId: string;
3149
- /** The policy decision (allow/ask/deny) */
3150
- decision: ToolPolicyDecision;
3151
- /** Full explain output used to derive the receipt */
3152
- explain: ToolPolicyExplanation;
3153
- /** The tool intent that was evaluated */
3154
- intent: ToolIntent;
3155
- /** Which rule matched (if any) */
3156
- matchedRule?: PolicyRuleMatch;
3157
- /** The scope in which the decision applies */
3158
- scope?: PermissionScopeInput;
3159
- /** Who or what originated the request */
3160
- origin?: PermissionApprovalOrigin;
3161
- /** How long the allow decision is valid (ms since epoch), if applicable */
3162
- ttl?: number;
3163
- /** Blocked command hint for deny decisions */
3164
- hint?: string;
3165
- /** Timeline envelope references for audit cross-referencing */
3166
- timelineRefs?: Array<{
3167
- epoch: string;
3168
- seq: number;
3169
- }>;
3170
- }
3171
- interface CreatePolicyDecisionReceiptOptions {
3172
- requestId: string;
3173
- policy: PermissionPolicy;
3174
- request: ToolPolicyRequest;
3175
- origin?: PermissionApprovalOrigin;
3176
- ttl?: number;
3177
- timelineRefs?: Array<{
3178
- epoch: string;
3179
- seq: number;
3180
- }>;
3181
- }
3182
- type PermissionScope = {
3183
- type: 'session';
3110
+ interface TimelineEnvelope<TItem = unknown> {
3184
3111
  sessionId: string;
3185
- } | {
3186
- type: 'workspace';
3187
- workspaceId: string;
3188
- } | {
3189
- type: 'source';
3190
- sourceSlug: string;
3191
- } | {
3192
- type: 'skill';
3193
- skillSlug: string;
3194
- } | {
3195
- type: 'automation';
3196
- automationId: string;
3197
- } | {
3198
- type: 'tool-call';
3199
- callId: string;
3200
- };
3201
- type PermissionScopeInput = string | PermissionScope;
3202
- type PermissionApprovalOrigin = {
3203
- type: 'user';
3204
- id?: string;
3205
- } | {
3206
- type: 'automation';
3207
- id: string;
3208
- } | {
3209
- type: 'system';
3210
- id?: string;
3211
- };
3212
- interface AlwaysAllowRule {
3213
- toolName: string;
3214
- scope?: PermissionScopeInput;
3215
- }
3216
- interface ApiEndpointRule {
3217
- method: string;
3218
- pattern: string;
3219
- }
3220
- interface BlockedCommandHintRule {
3221
- command: string;
3222
- reason: string;
3223
- whenNotMatching?: string;
3224
- tryInstead?: string[];
3225
- context?: string;
3226
- }
3227
- interface PolicyRuleSet {
3228
- allowedBashPatterns?: string[];
3229
- allowedMcpPatterns?: string[];
3230
- allowedApiEndpoints?: ApiEndpointRule[];
3231
- allowedWritePaths?: string[];
3232
- blockedCommandHints?: BlockedCommandHintRule[];
3233
- }
3234
- interface PolicyLayer {
3235
- id: string;
3236
- rules: PolicyRuleSet;
3237
- scope?: PermissionScopeInput;
3112
+ provider: string;
3113
+ seq: number;
3114
+ epoch: string;
3115
+ timestamp: number;
3116
+ item: TItem;
3117
+ rawRef?: unknown;
3238
3118
  }
3239
- interface PermissionApproval {
3240
- id: string;
3241
- toolName: string;
3242
- scope: PermissionScope;
3243
- origin: PermissionApprovalOrigin;
3244
- createdAt?: number;
3245
- expiresAt?: number;
3119
+ interface TimelineStream {
3120
+ connect(onEvent: (event: TimelineEnvelope) => void, onError?: (error: Error) => void, onClose?: () => void): void;
3121
+ disconnect(): void;
3122
+ isConnected(): boolean;
3246
3123
  }
3247
- interface PermissionApprovalStore {
3248
- remember(approval: PermissionApproval): void;
3249
- revoke(id: string): void;
3250
- snapshot(): PermissionApproval[];
3124
+
3125
+ /**
3126
+ * WeftHttpClient
3127
+ *
3128
+ * Typed HTTP client for the Weft Server REST API.
3129
+ * All methods map 1-to-1 with the server's HTTP endpoints.
3130
+ */
3131
+ interface WeftHttpClientOptions {
3132
+ /** Base URL of the Weft server, e.g. http://localhost:8080 */
3133
+ baseUrl: string;
3134
+ /** Optional bearer token for API-key auth */
3135
+ apiKey?: string;
3136
+ /** Optional tenant ID header */
3137
+ tenantId?: string;
3138
+ /** Optional timeout in milliseconds (default: 30000) */
3139
+ timeout?: number;
3140
+ /**
3141
+ * Scoped embed session token minted by the host backend via
3142
+ * `POST /v1/embed/sessions`. Sent as the Authorization bearer; the token
3143
+ * already carries tenant and session scope, so apiKey/tenantId are not
3144
+ * needed (and are ignored) when it is set.
3145
+ */
3146
+ token?: string;
3147
+ /**
3148
+ * Called when the server rejects the scoped token (HTTP 401, typically
3149
+ * expiry). Return a fresh token (e.g. by re-asking the host backend) and
3150
+ * the failed request is retried once; return undefined to surface the 401.
3151
+ */
3152
+ onTokenExpired?: () => Promise<string | undefined> | string | undefined;
3251
3153
  }
3252
- interface PermissionPolicy {
3253
- mode: PermissionMode;
3254
- alwaysAllow: AlwaysAllowRule[];
3255
- approvals: PermissionApproval[];
3256
- layers: PolicyLayer[];
3154
+ interface CreateEmbedSessionResponse {
3155
+ session_id: string;
3156
+ token: string;
3157
+ expires_at: number;
3158
+ base_url?: string;
3257
3159
  }
3258
- interface CreatePermissionPolicyOptions {
3259
- mode?: PermissionMode;
3260
- alwaysAllow?: AlwaysAllowRule[];
3261
- approvals?: PermissionApproval[];
3262
- layers?: PolicyLayer[];
3160
+ interface RefreshEmbedTokenResponse {
3161
+ session_id?: string;
3162
+ token: string;
3163
+ expires_at: number;
3164
+ }
3165
+ interface WeftSession {
3166
+ session_id: string;
3167
+ tenant_id: string;
3168
+ app_id?: string;
3169
+ external_account_id?: string;
3170
+ external_user_id?: string;
3171
+ principal_id?: string;
3172
+ auth_method?: string;
3173
+ project_id?: string;
3174
+ workspace_id?: string;
3175
+ title: string;
3176
+ status: string;
3177
+ labels?: string[];
3178
+ flagged?: boolean;
3179
+ topic?: string;
3180
+ config_snapshot: unknown;
3181
+ summary_snapshot?: unknown;
3182
+ created_at: string;
3183
+ updated_at: string;
3184
+ }
3185
+ interface WeftRun {
3186
+ run_id: string;
3187
+ session_id: string;
3188
+ tenant_id?: string;
3189
+ app_id?: string;
3190
+ external_account_id?: string;
3191
+ external_user_id?: string;
3192
+ parent_run_id?: string;
3193
+ status: string;
3194
+ execution_mode: string;
3195
+ permission_envelope?: string;
3196
+ input_message: string;
3197
+ config_snapshot?: unknown;
3198
+ model_profile?: string;
3199
+ skill_names?: string[];
3200
+ budget?: {
3201
+ max_steps?: number;
3202
+ max_tokens?: number;
3203
+ max_wall_time_sec?: number;
3204
+ };
3205
+ error?: string;
3206
+ started_at?: string;
3207
+ finished_at?: string;
3208
+ created_at: string;
3209
+ updated_at: string;
3263
3210
  }
3264
- interface CreateSourcePolicyLayerOptions {
3265
- sourceSlug: string;
3266
- rules: PolicyRuleSet;
3267
- id?: string;
3211
+ interface WeftCapabilityReport {
3212
+ provider: string;
3213
+ runtimeKind: string;
3214
+ selected: string;
3215
+ fallback: boolean;
3216
+ auth: {
3217
+ mode: string;
3218
+ configured: boolean;
3219
+ source: string;
3220
+ accountPresent?: boolean;
3221
+ method?: string;
3222
+ provider?: string;
3223
+ error?: string;
3224
+ };
3225
+ features: string[];
3226
+ policyCapabilities: Record<string, unknown>;
3227
+ sourceCapabilities: Record<string, unknown>;
3228
+ skillCapabilities: Record<string, unknown>;
3229
+ automationCapabilities: Record<string, unknown>;
3230
+ hostToolCapabilities: Record<string, unknown>;
3231
+ }
3232
+ interface WeftPatchSessionOptions {
3233
+ title?: string;
3234
+ status?: string;
3235
+ labels?: string[];
3236
+ flagged?: boolean;
3237
+ topic?: string;
3268
3238
  }
3269
- interface PolicyConfigLayer {
3239
+ interface WeftModelInfo {
3270
3240
  id: string;
3271
- sourceSlug?: string;
3272
- scope?: PermissionScopeInput;
3273
- rules: PolicyRuleSet;
3274
- }
3275
- interface PolicyConfigFile {
3276
- mode?: PermissionMode;
3277
- alwaysAllow?: AlwaysAllowRule[];
3278
- approvals?: PermissionApproval[];
3279
- layers?: PolicyConfigLayer[];
3241
+ provider: string;
3242
+ display_name?: string;
3243
+ aliases?: string[];
3244
+ capabilities: Record<string, unknown>;
3280
3245
  }
3281
- interface PolicyConfigIssue {
3282
- path: string;
3283
- message: string;
3284
- suggestion?: string;
3246
+ interface WeftModelListResult {
3247
+ models: WeftModelInfo[];
3248
+ default?: string;
3285
3249
  }
3286
- interface PolicyConfigValidationResult {
3287
- valid: boolean;
3288
- errors: PolicyConfigIssue[];
3289
- warnings: PolicyConfigIssue[];
3250
+ interface WeftTimelineItem {
3251
+ sessionId: string;
3252
+ provider: string;
3253
+ seq: number;
3254
+ epoch: string;
3255
+ timestamp: number;
3256
+ item: Record<string, unknown>;
3290
3257
  }
3291
- interface CreatePermissionPolicyFromConfigResult {
3292
- validation: PolicyConfigValidationResult;
3293
- policy?: PermissionPolicy;
3258
+ interface WeftTimelineFetchResult {
3259
+ items: WeftTimelineItem[];
3260
+ nextCursor: {
3261
+ epoch: string;
3262
+ afterSeq: number;
3263
+ };
3264
+ hasGap: boolean;
3294
3265
  }
3295
- interface ToolPolicyRequest {
3296
- toolName: string;
3297
- input?: Record<string, unknown>;
3298
- toolIntent?: ToolIntent;
3299
- scope?: PermissionScopeInput;
3266
+ declare class WeftHttpClient {
3267
+ private readonly baseUrl;
3268
+ private readonly timeout;
3269
+ private readonly apiKey;
3270
+ private readonly tenantId;
3271
+ private readonly onTokenExpired?;
3272
+ private token;
3273
+ private readonly embedMode;
3274
+ constructor(options: WeftHttpClientOptions);
3275
+ private sessionPath;
3276
+ /** Current Authorization bearer (scoped token wins over apiKey). */
3277
+ getBearerToken(): string;
3278
+ /** Replace the scoped token (e.g. after a host-backend refresh). */
3279
+ setToken(token: string): void;
3280
+ private buildHeaders;
3281
+ preflight(): Promise<WeftCapabilityReport>;
3282
+ health(): Promise<{
3283
+ status: string;
3284
+ }>;
3285
+ createSession(options?: {
3286
+ title?: string;
3287
+ model?: string;
3288
+ skillNames?: string[];
3289
+ mcpServerNames?: string[];
3290
+ }): Promise<WeftSession>;
3291
+ getSession(sessionId: string): Promise<WeftSession>;
3292
+ sendMessage(sessionId: string, message: string, options?: {
3293
+ model?: string;
3294
+ skillNames?: string[];
3295
+ mcpServerNames?: string[];
3296
+ toolNames?: string[];
3297
+ approvalPolicy?: string;
3298
+ executionMode?: string;
3299
+ workspaceId?: string;
3300
+ budget?: {
3301
+ maxSteps?: number;
3302
+ maxTokens?: number;
3303
+ maxWallTimeSec?: number;
3304
+ };
3305
+ }): Promise<WeftRun>;
3306
+ cancelRun(runId: string): Promise<{
3307
+ status: string;
3308
+ }>;
3309
+ /**
3310
+ * Refresh a session's scoped embed token from the developer backend
3311
+ * (tenant API key bearer). `expires_at` is Unix seconds, matching
3312
+ * server-go/internal/api/handlers_embed.go CreateEmbedSessionResponse.
3313
+ */
3314
+ refreshSessionToken(sessionId: string, options?: {
3315
+ ttlSeconds?: number;
3316
+ credential?: unknown;
3317
+ }): Promise<RefreshEmbedTokenResponse>;
3318
+ resumeTool(runId: string, resumeData: Record<string, unknown>): Promise<{
3319
+ status: string;
3320
+ }>;
3321
+ respondToPermission(sessionId: string, requestId: string, allowed: boolean, options?: {
3322
+ remember?: boolean;
3323
+ text?: string;
3324
+ answer?: unknown;
3325
+ }): Promise<{
3326
+ ok: boolean;
3327
+ type: string;
3328
+ requestId: string;
3329
+ }>;
3330
+ patchSession(sessionId: string, patch: WeftPatchSessionOptions): Promise<WeftSession>;
3331
+ listModels(): Promise<WeftModelListResult>;
3332
+ fetchTimeline(sessionId: string, afterSeq?: number, limit?: number): Promise<WeftTimelineFetchResult>;
3333
+ /** Returns the SSE stream URL for a session's canonical timeline. */
3334
+ sessionTimelineUrl(sessionId: string): string;
3335
+ private get;
3336
+ private post;
3337
+ private patch;
3338
+ private request;
3300
3339
  }
3301
- interface CreateApprovalStoreOptions {
3340
+
3341
+ /**
3342
+ * WeftSseTimelineStream
3343
+ *
3344
+ * Consumes the session-scoped SSE timeline endpoint and exposes it as
3345
+ * a Weft TimelineStream. Handles reconnection with cursor tracking.
3346
+ */
3347
+
3348
+ interface WeftSseTimelineStreamOptions {
3349
+ /** Full URL to the session timeline SSE endpoint */
3350
+ url: string;
3351
+ /** Optional bearer token */
3352
+ apiKey?: string;
3353
+ /** Optional tenant ID header */
3354
+ tenantId?: string;
3355
+ /** Reconnect delay in ms (default: 1500) */
3356
+ reconnectDelayMs?: number;
3357
+ /** Maximum reconnect attempts (default: 20) */
3358
+ maxReconnectAttempts?: number;
3359
+ /** Starting afterSeq cursor for gap-aware reconnection */
3360
+ initialAfterSeq?: number;
3302
3361
  now?: () => number;
3362
+ /**
3363
+ * Returns the current Authorization bearer (e.g. a scoped embed token that
3364
+ * may rotate). Wins over apiKey when it returns a non-empty value.
3365
+ */
3366
+ getBearerToken?: () => string;
3367
+ /**
3368
+ * Called when the stream is rejected with HTTP 401. Return a fresh token to
3369
+ * resume streaming (also update the HTTP client), or undefined to give up.
3370
+ */
3371
+ onTokenExpired?: () => Promise<string | undefined> | string | undefined;
3372
+ }
3373
+ declare class WeftSseTimelineStream implements TimelineStream {
3374
+ private listeners;
3375
+ private eventSource;
3376
+ private disposed;
3377
+ private reconnectAttempts;
3378
+ private afterSeq;
3379
+ private readonly getBearerToken?;
3380
+ private readonly options;
3381
+ constructor(options: WeftSseTimelineStreamOptions);
3382
+ connect(onEvent: (event: TimelineEnvelope) => void, onError?: (error: Error) => void, onClose?: () => void): void;
3383
+ disconnect(): void;
3384
+ isConnected(): boolean;
3385
+ private openEventSource;
3386
+ private closeEventSource;
3387
+ private scheduleReconnect;
3388
+ private emitError;
3389
+ }
3390
+ /**
3391
+ * In Node.js environments (Node 18+) EventSource may not be available globally.
3392
+ * This minimal polyfill wraps the fetch API for SSE consumption.
3393
+ */
3394
+ declare class WeftFetchSseTimelineStream implements TimelineStream {
3395
+ private listeners;
3396
+ private abortController;
3397
+ private connected;
3398
+ private disposed;
3399
+ private afterSeq;
3400
+ private reconnectAttempts;
3401
+ private tokenOverride;
3402
+ private readonly getBearerToken?;
3403
+ private readonly onTokenExpired?;
3404
+ private readonly options;
3405
+ constructor(options: WeftSseTimelineStreamOptions);
3406
+ connect(onEvent: (event: TimelineEnvelope) => void, onError?: (error: Error) => void, onClose?: () => void): void;
3407
+ disconnect(): void;
3408
+ isConnected(): boolean;
3409
+ private buildUrl;
3410
+ private buildHeaders;
3411
+ private startFetch;
3412
+ private scheduleReconnect;
3413
+ private emitError;
3303
3414
  }
3304
- declare function createPermissionPolicy(options?: CreatePermissionPolicyOptions): PermissionPolicy;
3305
- declare function createSourcePolicyLayer(options: CreateSourcePolicyLayerOptions): PolicyLayer;
3306
- declare function validatePolicyConfig(input: unknown): PolicyConfigValidationResult;
3307
- declare function createPermissionPolicyFromConfig(input: unknown): CreatePermissionPolicyFromConfigResult;
3308
- declare function evaluateToolPolicy(policy: PermissionPolicy, request: ToolPolicyRequest): ToolPolicyDecision;
3309
- declare function createPolicyDecisionReceipt(options: CreatePolicyDecisionReceiptOptions): PolicyDecisionReceipt;
3310
- declare function explainToolPolicy(policy: PermissionPolicy, request: ToolPolicyRequest): ToolPolicyExplanation;
3311
- declare function createInMemoryApprovalStore(options?: CreateApprovalStoreOptions): PermissionApprovalStore;
3312
- interface BlockedCommandHintResult {
3313
- reason: string;
3314
- match: PolicyRuleMatch;
3315
- tryInstead?: string[];
3316
- context?: string;
3415
+ /**
3416
+ * Create an SSE stream for the timeline endpoint.
3417
+ * Always uses the fetch-based implementation so credentials are sent via
3418
+ * Authorization header rather than URL query parameters.
3419
+ */
3420
+ declare function createTimelineStream(options: WeftSseTimelineStreamOptions): TimelineStream;
3421
+
3422
+ /**
3423
+ * WeftClient — the public L2 ("headless") contract.
3424
+ *
3425
+ * A thin namespaced facade over WeftHttpClient + the SSE timeline stream:
3426
+ *
3427
+ * ```ts
3428
+ * const client = new WeftClient({ server, token })
3429
+ * const stream = client.timeline.subscribe(sessionId) // SSE, auto-reconnect
3430
+ * for await (const envelope of stream) render(envelope)
3431
+ * await client.runs.create(sessionId, { message: '买一个机械键盘并付款' })
3432
+ * ```
3433
+ */
3434
+
3435
+ interface WeftClientOptions {
3436
+ /** Base URL of the agent server, e.g. https://agents.example.com */
3437
+ server: string;
3438
+ /**
3439
+ * Scoped embed-session token minted by your backend
3440
+ * (`POST /v1/embed/sessions`). Carries tenant + session scope.
3441
+ */
3442
+ token?: string;
3443
+ /** Developer API key (server-side use; prefer `token` in browsers). */
3444
+ apiKey?: string;
3445
+ /** Tenant ID header for apiKey auth (ignored when `token` is set). */
3446
+ tenantId?: string;
3447
+ /** Request timeout in milliseconds (default 30000). */
3448
+ timeout?: number;
3449
+ /**
3450
+ * Called on HTTP 401 with a scoped token. Return a fresh token (e.g. by
3451
+ * re-asking your backend) to retry once; return undefined to surface the 401.
3452
+ */
3453
+ onTokenExpired?: WeftHttpClientOptions['onTokenExpired'];
3454
+ }
3455
+ interface TimelineSubscription extends TimelineStream, AsyncIterable<TimelineEnvelope> {
3456
+ }
3457
+ declare class WeftClient {
3458
+ /** The underlying 1:1 HTTP client, for endpoints not wrapped below. */
3459
+ readonly http: WeftHttpClient;
3460
+ private readonly options;
3461
+ constructor(options: WeftClientOptions);
3462
+ /** Replace the scoped token (e.g. after a backend-driven refresh). */
3463
+ setToken(token: string): void;
3464
+ readonly sessions: {
3465
+ create: (options?: Parameters<WeftHttpClient["createSession"]>[0]) => Promise<WeftSession>;
3466
+ get: (sessionId: string) => Promise<WeftSession>;
3467
+ patch: (sessionId: string, patch: WeftPatchSessionOptions) => Promise<WeftSession>;
3468
+ respondToPermission: (sessionId: string, requestId: string, allowed: boolean, options?: {
3469
+ remember?: boolean;
3470
+ text?: string;
3471
+ answer?: unknown;
3472
+ }) => Promise<{
3473
+ ok: boolean;
3474
+ type: string;
3475
+ requestId: string;
3476
+ }>;
3477
+ };
3478
+ readonly runs: {
3479
+ create: (sessionId: string, options: {
3480
+ message: string;
3481
+ } & NonNullable<Parameters<WeftHttpClient["sendMessage"]>[2]>) => Promise<WeftRun>;
3482
+ cancel: (runId: string) => Promise<{
3483
+ status: string;
3484
+ }>;
3485
+ resumeTool: (runId: string, resumeData: Record<string, unknown>) => Promise<{
3486
+ status: string;
3487
+ }>;
3488
+ };
3489
+ readonly timeline: {
3490
+ fetch: (sessionId: string, afterSeq?: number, limit?: number) => Promise<WeftTimelineFetchResult>;
3491
+ /**
3492
+ * Subscribe to the session's SSE timeline. Reconnects automatically with
3493
+ * cursor tracking; usable both callback-style (`connect`) and as an
3494
+ * async iterable (`for await`).
3495
+ */
3496
+ subscribe: (sessionId: string, options?: Partial<Omit<WeftSseTimelineStreamOptions, "url">>) => TimelineSubscription;
3497
+ };
3317
3498
  }
3318
3499
 
3319
- export { type AlwaysAllowRule, type ApiEndpointRule, type BlockedCommandHintResult, type BlockedCommandHintRule, type CreateApprovalStoreOptions, type CreatePermissionPolicyFromConfigResult, type CreatePermissionPolicyOptions, type CreatePolicyDecisionReceiptOptions, type CreateSourcePolicyLayerOptions, type PermissionApproval, type PermissionApprovalOrigin, type PermissionApprovalStore, type PermissionPolicy, type PermissionScope, type PermissionScopeInput, type PolicyConfigFile, type PolicyConfigIssue, type PolicyConfigLayer, type PolicyConfigValidationResult, type PolicyDecisionReceipt, type PolicyLayer, type PolicyRuleMatch, type PolicyRuleSet, type ToolIntent, type ToolPolicyDecision, type ToolPolicyExplanation, type ToolPolicyRequest, createInMemoryApprovalStore, createPermissionPolicy, createPermissionPolicyFromConfig, createPolicyDecisionReceipt, createSourcePolicyLayer, evaluateToolPolicy, explainToolPolicy, validatePolicyConfig };
3500
+ export { type CreateEmbedSessionResponse, type RefreshEmbedTokenResponse, type TimelineEnvelope, type TimelineStream, type TimelineSubscription, type WeftCapabilityReport, WeftClient, type WeftClientOptions, WeftFetchSseTimelineStream, WeftHttpClient, type WeftHttpClientOptions, type WeftModelInfo, type WeftModelListResult, type WeftPatchSessionOptions, type WeftRun, type WeftSession, WeftSseTimelineStream, type WeftSseTimelineStreamOptions, type WeftTimelineFetchResult, type WeftTimelineItem, createTimelineStream };
3320
3501
 
3321
- // -- @weft/policy/loader.d.ts --
3322
- import '@weft/core';
3502
+ // ── inlined from @weft/provider-flitro ──
3503
+ // -- @weft/provider-flitro/index.d.ts --
3323
3504
 
3324
- interface PolicyFileContents {
3325
- allowedBashPatterns?: string[];
3326
- allowedMcpPatterns?: string[];
3327
- allowedApiEndpoints?: ApiEndpointRule[];
3328
- allowedWritePaths?: string[];
3329
- blockedCommandHints?: BlockedCommandHintRule[];
3330
- }
3331
- interface PolicyFileLoadResult {
3332
- rules: PolicyRuleSet;
3333
- path: string;
3334
- errors: string[];
3505
+ /**
3506
+ * FlitroProviderRuntimeDriver
3507
+ *
3508
+ * Sends messages to the Flitro Go server and routes permission responses back.
3509
+ * Implements the same driver interface pattern as provider-claude's
3510
+ * ClaudeProviderRuntimeDriver.
3511
+ */
3512
+
3513
+ interface FlitroDriverInput {
3514
+ message: string;
3515
+ options?: SendMessageOptions;
3335
3516
  }
3336
- interface LoadPolicyLayersOptions {
3337
- globalPath?: string;
3338
- workspacePath?: string;
3517
+ interface FlitroProviderRuntimeDriver {
3518
+ sendMessage(input: FlitroDriverInput, sequencer: TimelineSequencer): Promise<void>;
3519
+ abort?(reason?: string): Promise<void>;
3520
+ respondToPermission?(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
3521
+ resumeTool?(runId: string, resumeData: Record<string, unknown>): Promise<void>;
3522
+ dispose?(): Promise<void>;
3339
3523
  }
3340
- declare function loadPolicyFile(filePath: string): Promise<PolicyFileLoadResult>;
3341
- declare function loadPolicyLayers(options?: LoadPolicyLayersOptions): Promise<{
3342
- layers: PolicyLayer[];
3343
- errors: string[];
3344
- }>;
3524
+ interface CreateFlitroDriverOptions {
3525
+ client: WeftHttpClient;
3526
+ sessionId: string;
3527
+ /** LLM model override sent to Flitro */
3528
+ model?: string;
3529
+ /** Skill names to activate for each message */
3530
+ skillNames?: string[];
3531
+ /** MCP server names to attach */
3532
+ mcpServerNames?: string[];
3533
+ /** Default approval policy: "never", "on-request", "always", "auto" */
3534
+ approvalPolicy?: string;
3535
+ }
3536
+ /**
3537
+ * Creates a runtime driver that delegates to the Flitro server.
3538
+ *
3539
+ * sendMessage creates a Flitro Run (one message = one turn = one Run).
3540
+ * The timeline events flow back via the SSE stream set up separately.
3541
+ */
3542
+ declare function createFlitroDriver(options: CreateFlitroDriverOptions): FlitroProviderRuntimeDriver;
3345
3543
 
3346
- export { type LoadPolicyLayersOptions, type PolicyFileContents, type PolicyFileLoadResult, loadPolicyFile, loadPolicyLayers };
3544
+ /**
3545
+ * FlitroCapabilityProbe
3546
+ *
3547
+ * Detects whether a Flitro server is reachable and authenticated, then
3548
+ * builds the RuntimeCandidate list for createFlitroRuntimeCapabilityReport.
3549
+ */
3347
3550
 
3348
- // -- @weft/policy/merge.d.ts --
3349
- import '@weft/core';
3551
+ interface FlitroCapabilityProbeResult {
3552
+ serverAvailable: boolean;
3553
+ authenticated: boolean;
3554
+ serverReason?: string;
3555
+ authReason?: string;
3556
+ candidates: RuntimeCandidate[];
3557
+ auth: RuntimeAuthDetection;
3558
+ }
3559
+ /**
3560
+ * Probe the Flitro server and return availability + auth candidates.
3561
+ *
3562
+ * Flitro is always an "app-server" runtime kind — it runs as an external
3563
+ * process (the Go agentd binary) that the TypeScript provider communicates
3564
+ * with over HTTP.
3565
+ */
3566
+ declare function probeFlitroCapabilities(client: WeftHttpClient): Promise<FlitroCapabilityProbeResult>;
3350
3567
 
3351
3568
  /**
3352
- * Merge multiple PolicyRuleSets into one. Later entries take precedence
3353
- * for blockedCommandHints (last hint per command wins), while array fields
3354
- * (patterns, paths, endpoints) are concatenated and deduplicated.
3569
+ * @weft/provider-flitro
3570
+ *
3571
+ * Weft Runtime Provider for the Flitro Go Agent Server.
3572
+ *
3573
+ * Flitro is the 3rd AgentRuntime alongside Claude and Codex:
3574
+ * - provider-claude → Claude Agent SDK (native-sdk) / claude -p (cli-fallback)
3575
+ * - provider-codex → Codex app-server / codex exec (cli-fallback)
3576
+ * - provider-flitro → Flitro agentd HTTP API (app-server)
3577
+ *
3578
+ * Integration model:
3579
+ * - Flitro runs as the Go backend (stateful, multi-tenant, concurrent)
3580
+ * - This provider wraps Flitro's REST+SSE API as a Weft AgentRuntime
3581
+ * - Weft policy, sources, and skills are forwarded as API parameters
3582
+ * - The Weft UI (TurnCard, etc.) consumes the canonical timeline
3355
3583
  */
3356
- declare function mergePolicyRuleSets(...sets: PolicyRuleSet[]): PolicyRuleSet;
3584
+
3585
+ interface CreateFlitroRuntimeCandidatesOptions {
3586
+ appServerAvailable: boolean;
3587
+ appServerReason?: string;
3588
+ }
3589
+ declare function createFlitroRuntimeCandidates(options: CreateFlitroRuntimeCandidatesOptions): RuntimeCandidate[];
3590
+ interface CreateFlitroRuntimeCapabilityReportOptions {
3591
+ candidates: RuntimeCandidate[];
3592
+ auth: RuntimeAuthDetection;
3593
+ allowFallback?: boolean;
3594
+ extensions?: RuntimeExtensionContext;
3595
+ }
3596
+ declare function createFlitroRuntimeCapabilityReport(options: CreateFlitroRuntimeCapabilityReportOptions): RuntimeCapabilityReport;
3597
+ interface CreateFlitroProviderRuntimeOptions extends CreateFlitroRuntimeCapabilityReportOptions {
3598
+ /** Flitro server connection options */
3599
+ server: WeftHttpClientOptions;
3600
+ /** Session ID — if omitted a new session is created on first sendMessage */
3601
+ sessionId?: string;
3602
+ /** Epoch string for the timeline (default: derived from sessionId) */
3603
+ epoch?: string;
3604
+ now?: () => number;
3605
+ /** LLM model to use */
3606
+ model?: string;
3607
+ /** Skills to activate per turn */
3608
+ skillNames?: string[];
3609
+ /** MCP servers to attach per turn */
3610
+ mcpServerNames?: string[];
3611
+ /** Approval policy */
3612
+ approvalPolicy?: string;
3613
+ /** Injected runtime extensions (policy, sources, etc.) */
3614
+ extensions?: RuntimeExtensionContext;
3615
+ /** Pre-built driver (for testing) */
3616
+ driver?: FlitroProviderRuntimeDriver;
3617
+ }
3618
+ /**
3619
+ * Create a Weft AgentRuntime backed by the Flitro Go server.
3620
+ *
3621
+ * Usage:
3622
+ * ```ts
3623
+ * const runtime = createFlitroProviderRuntime({
3624
+ * server: { baseUrl: 'http://localhost:8080', apiKey: 'secret' },
3625
+ * candidates: [{ kind: 'app-server', available: true }],
3626
+ * auth: { mode: 'provider-owned', configured: true, source: 'flitro' },
3627
+ * sessionId: 'my-session',
3628
+ * })
3629
+ * await runtime.preflight()
3630
+ * await runtime.commands.sendMessage('Hello!')
3631
+ * ```
3632
+ */
3633
+ declare function createFlitroProviderRuntime(options: CreateFlitroProviderRuntimeOptions): AgentRuntime;
3634
+ interface CreateFlitroEmbedRuntimeOptions {
3635
+ /** Flitro server base URL, as returned by `POST /v1/embed/sessions`. */
3636
+ baseUrl: string;
3637
+ /** Scoped session token, as returned by `POST /v1/embed/sessions`. */
3638
+ token: string;
3639
+ /** Session bound to the token, as returned by `POST /v1/embed/sessions`. */
3640
+ sessionId: string;
3641
+ /** Re-fetch a token from the host backend when the current one expires. */
3642
+ onTokenExpired?: () => Promise<string | undefined> | string | undefined;
3643
+ epoch?: string;
3644
+ now?: () => number;
3645
+ extensions?: RuntimeExtensionContext;
3646
+ }
3647
+ /**
3648
+ * Create an AgentRuntime for an embedded (third-party website) chat panel.
3649
+ *
3650
+ * The host backend bootstraps the session via Flitro's `POST /v1/embed/sessions`
3651
+ * (with its developer API key) and hands `{ baseUrl, token, sessionId }` to the
3652
+ * browser. Execution mode, permission envelope, approval policy, and the tool
3653
+ * whitelist are fixed server-side, so no runtime auth or policy configuration
3654
+ * is needed here.
3655
+ */
3656
+ declare function createFlitroEmbedRuntime(options: CreateFlitroEmbedRuntimeOptions): AgentRuntime;
3657
+ interface CreateFlitroRuntimeOptions {
3658
+ /** Flitro server connection options */
3659
+ server: WeftHttpClientOptions;
3660
+ sessionId?: string;
3661
+ epoch?: string;
3662
+ now?: () => number;
3663
+ model?: string;
3664
+ skillNames?: string[];
3665
+ mcpServerNames?: string[];
3666
+ approvalPolicy?: string;
3667
+ allowFallback?: boolean;
3668
+ extensions?: RuntimeExtensionContext;
3669
+ }
3357
3670
  /**
3358
- * Merge multiple PolicyLayers into a single flat layer. Used when
3359
- * combining global + workspace file-based layers into one layer
3360
- * before appending to a policy's existing layers.
3671
+ * High-level factory: probes the Flitro server, then creates the runtime.
3672
+ *
3673
+ * Equivalent to the pattern used by createHostAgentRuntime() in runtime-factory.
3361
3674
  */
3362
- declare function mergePolicyLayers(layers: PolicyLayer[], id: string): PolicyLayer | undefined;
3675
+ declare function createFlitroRuntime(options: CreateFlitroRuntimeOptions): Promise<AgentRuntime>;
3363
3676
 
3364
- export { mergePolicyLayers, mergePolicyRuleSets };
3677
+ export { type CreateFlitroDriverOptions, type CreateFlitroEmbedRuntimeOptions, type CreateFlitroProviderRuntimeOptions, type CreateFlitroRuntimeCandidatesOptions, type CreateFlitroRuntimeCapabilityReportOptions, type CreateFlitroRuntimeOptions, type FlitroCapabilityProbeResult, type FlitroProviderRuntimeDriver, createFlitroDriver, createFlitroEmbedRuntime, createFlitroProviderRuntime, createFlitroRuntime, createFlitroRuntimeCandidates, createFlitroRuntimeCapabilityReport, probeFlitroCapabilities };