@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/chat.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { EN_FALLBACK };
2
+ export { AgentSession, UseAgentSessionOptions, useAgentSession };
2
3
 
3
4
  // ── inlined from @weft/core ──
4
5
  // -- @weft/core/index.d.ts --
@@ -3941,877 +3942,3 @@ export { ActivityDetailsPanel, ActivityInspector, type ActivityItem, type Activi
3941
3942
  declare const EN_FALLBACK: Record<string, string>;
3942
3943
 
3943
3944
  export { EN_FALLBACK };
3944
-
3945
- // ── inlined from @weft/runtime-core ──
3946
- // -- @weft/runtime-core/index.d.ts --
3947
-
3948
- declare const RUNTIME_KINDS: readonly ["native-sdk", "app-server", "compatible-sdk", "cli-fallback"];
3949
- type AgentRuntimeKind = typeof RUNTIME_KINDS[number];
3950
- type AgentRuntimeStatus = 'idle' | 'preflighting' | 'ready' | 'starting' | 'running' | 'waiting_for_permission' | 'turn_completed' | 'completed' | 'failed' | 'disposed';
3951
-
3952
- /**
3953
- * How a provider's authentication is managed.
3954
- * Provider-neutral auth mode — covers native SDK, app-server, compatible SDK, and CLI fallback.
3955
- */
3956
- type ProviderAuthMode = 'provider-owned' | 'managed' | 'none';
3957
- /**
3958
- * Result of probing a provider's auth configuration.
3959
- *
3960
- * For provider-owned auth: checks whether the provider binary reports
3961
- * authentication as configured (e.g. `claude auth status --json` returns
3962
- * `loggedIn: true`, or `codex app-server account/read` returns an account).
3963
- *
3964
- * For managed auth: checks whether required env vars are present.
3965
- * For 'none': no auth required (e.g. fake backend for testing).
3966
- */
3967
- interface ProviderAuthDetection {
3968
- /** Which auth mode this provider uses */
3969
- mode: ProviderAuthMode;
3970
- /** Whether auth credentials are available and valid */
3971
- configured: boolean;
3972
- /** How auth was detected (e.g. "claude auth status --json", "env vars") */
3973
- source: string;
3974
- /** Whether an account was found (provider-owned: from CLI output) */
3975
- accountPresent?: boolean;
3976
- /** Whether OpenAI auth is required (Codex-specific) */
3977
- requiresOpenaiAuth?: boolean;
3978
- /** Auth method reported by provider (e.g. "oauth", "api_key") */
3979
- method?: string;
3980
- /** Provider name reported by CLI (e.g. "anthropic") */
3981
- provider?: string;
3982
- /** Error message if auth detection failed */
3983
- error?: string;
3984
- }
3985
- /**
3986
- * Narrowed auth detection for runtime capability reports.
3987
- * Only covers provider-owned auth, which is the SDK-first default.
3988
- */
3989
- interface RuntimeAuthDetection extends ProviderAuthDetection {
3990
- mode: 'provider-owned';
3991
- }
3992
- interface RuntimeCandidate {
3993
- kind: AgentRuntimeKind;
3994
- available: boolean;
3995
- reason?: string;
3996
- }
3997
- interface RuntimeSelectionOptions {
3998
- provider?: string;
3999
- candidates: RuntimeCandidate[];
4000
- preferredRuntime?: AgentRuntimeKind;
4001
- allowFallback?: boolean;
4002
- }
4003
- interface RuntimeSelection {
4004
- selected?: AgentRuntimeKind;
4005
- fallback: boolean;
4006
- fallbackReason?: string;
4007
- error?: string;
4008
- }
4009
- interface RuntimeCapabilityReport extends RuntimeSelection {
4010
- provider: string;
4011
- candidates: RuntimeCandidate[];
4012
- preferredRuntime?: AgentRuntimeKind;
4013
- allowFallback: boolean;
4014
- auth: RuntimeAuthDetection;
4015
- policyCapabilities: RuntimePolicyCapabilities;
4016
- sourceCapabilities: RuntimeSourceCapabilities;
4017
- skillCapabilities: RuntimeSkillCapabilities;
4018
- automationCapabilities: RuntimeAutomationCapabilities;
4019
- hostToolCapabilities: RuntimeHostToolCapabilities;
4020
- }
4021
- interface CreateRuntimeCapabilityReportOptions extends RuntimeSelectionOptions {
4022
- provider: string;
4023
- auth: RuntimeAuthDetection;
4024
- extensionCapabilities?: RuntimeExtensionCapabilities;
4025
- }
4026
- interface AgentRuntimeOptions {
4027
- provider: string;
4028
- cwd: string;
4029
- sessionId?: string;
4030
- model?: string;
4031
- reasoningEffort?: string;
4032
- permissionMode?: PermissionMode;
4033
- authMode?: 'provider-owned';
4034
- preferredRuntime?: AgentRuntimeKind;
4035
- allowFallback?: boolean;
4036
- executable?: string;
4037
- env?: Record<string, string>;
4038
- extensions?: RuntimeExtensionContext;
4039
- }
4040
- interface SendMessageOptions {
4041
- turnId?: string;
4042
- model?: string;
4043
- reasoningEffort?: string;
4044
- permissionMode?: PermissionMode;
4045
- commandOrigin?: CommandOrigin;
4046
- }
4047
- type ToolPolicyDecision = {
4048
- decision: 'allow';
4049
- } | {
4050
- decision: 'ask';
4051
- reason: string;
4052
- } | {
4053
- decision: 'deny';
4054
- reason: string;
4055
- };
4056
- interface CodexPermissionParams {
4057
- approvalPolicy: string;
4058
- approvalsReviewer: string;
4059
- sandbox: string;
4060
- }
4061
- /**
4062
- * Canonical PermissionMode → Codex permission parameters mapping, shared by
4063
- * the app-server driver (thread/start, turn/start), the host controller, and
4064
- * the CLI fallback runtime. `sandbox` is a Codex `SandboxMode` string as used
4065
- * by `thread/start` and `codex exec --sandbox`.
4066
- */
4067
- declare function mapPermissionModeToCodexParams(mode: PermissionMode): CodexPermissionParams;
4068
- /**
4069
- * Codex app-server v2 `turn/start` takes a tagged `SandboxPolicy` object,
4070
- * unlike `thread/start` which takes a plain `SandboxMode` string. Variant
4071
- * fields are all serde-defaulted, so the minimal `{ type }` form is valid.
4072
- */
4073
- declare function mapCodexSandboxModeToSandboxPolicy(sandbox: string): {
4074
- type: string;
4075
- };
4076
- type RuntimePermissionScope = {
4077
- type: 'session';
4078
- sessionId: string;
4079
- } | {
4080
- type: 'workspace';
4081
- workspaceId: string;
4082
- } | {
4083
- type: 'source';
4084
- sourceSlug: string;
4085
- } | {
4086
- type: 'skill';
4087
- skillSlug: string;
4088
- } | {
4089
- type: 'automation';
4090
- automationId: string;
4091
- } | {
4092
- type: 'tool-call';
4093
- callId: string;
4094
- };
4095
- type RuntimePermissionScopeInput = string | RuntimePermissionScope;
4096
- type RuntimeToolIntent = {
4097
- kind: 'bash';
4098
- command: string;
4099
- baseCommand: string;
4100
- } | {
4101
- kind: 'file_write';
4102
- path: string;
4103
- toolName: string;
4104
- } | {
4105
- kind: 'mcp';
4106
- name: string;
4107
- } | {
4108
- kind: 'api';
4109
- method: string;
4110
- path: string;
4111
- url?: string;
4112
- } | {
4113
- kind: 'unknown';
4114
- toolName: string;
4115
- };
4116
- interface ToolPolicyRequest {
4117
- toolName: string;
4118
- input?: Record<string, unknown>;
4119
- toolIntent?: RuntimeToolIntent;
4120
- scope?: RuntimePermissionScopeInput;
4121
- }
4122
- type RuntimePolicyHook = (request: ToolPolicyRequest) => ToolPolicyDecision | Promise<ToolPolicyDecision>;
4123
- interface RuntimeFeatureCapabilities {
4124
- supported: boolean;
4125
- degraded?: boolean;
4126
- reason?: string;
4127
- }
4128
- interface RuntimePolicyCapabilities extends RuntimeFeatureCapabilities {
4129
- modes: PermissionMode[];
4130
- approvals: boolean;
4131
- toolPolicy: boolean;
4132
- }
4133
- interface RuntimeSourceCapabilities extends RuntimeFeatureCapabilities {
4134
- registry?: boolean;
4135
- credentialGateway?: boolean;
4136
- mcpTools?: boolean;
4137
- }
4138
- interface RuntimeSkillCapabilities extends RuntimeFeatureCapabilities {
4139
- registry?: boolean;
4140
- activationPlan?: boolean;
4141
- scopedPolicy?: boolean;
4142
- }
4143
- interface RuntimeAutomationCapabilities extends RuntimeFeatureCapabilities {
4144
- eventBus: boolean;
4145
- schedulerHost: boolean;
4146
- promptAction: boolean;
4147
- webhookAction: boolean;
4148
- }
4149
- interface RuntimeHostToolCapabilities extends RuntimeFeatureCapabilities {
4150
- sessionTools: boolean;
4151
- workflowTransitions: boolean;
4152
- browserActions: boolean;
4153
- metadataWrites: boolean;
4154
- }
4155
- interface RuntimeExtensionCapabilities {
4156
- policy?: RuntimePolicyCapabilities;
4157
- sources?: RuntimeSourceCapabilities;
4158
- skills?: RuntimeSkillCapabilities;
4159
- automations?: RuntimeAutomationCapabilities;
4160
- hostTools?: RuntimeHostToolCapabilities;
4161
- }
4162
- interface RuntimePolicyExtension {
4163
- mode: PermissionMode;
4164
- hook?: RuntimePolicyHook;
4165
- degraded?: boolean;
4166
- }
4167
- interface SourceSelection {
4168
- enabledSourceSlugs: string[];
4169
- }
4170
- interface ProviderSourceCredentialRef {
4171
- type: string;
4172
- sourceSlug: string;
4173
- workspaceId?: string;
4174
- }
4175
- type ProviderSourceToolDescriptor = {
4176
- kind: 'api-source';
4177
- sourceSlug: string;
4178
- baseUrl: string;
4179
- authType: string;
4180
- defaultHeaders?: Record<string, string>;
4181
- credentialRef?: ProviderSourceCredentialRef;
4182
- [key: string]: unknown;
4183
- } | {
4184
- kind: 'local-source';
4185
- sourceSlug: string;
4186
- path: string;
4187
- format?: string;
4188
- [key: string]: unknown;
4189
- } | {
4190
- kind: 'mcp-server';
4191
- sourceSlug: string;
4192
- transport: 'stdio' | 'http' | 'sse';
4193
- url?: string;
4194
- command?: string;
4195
- args?: string[];
4196
- env?: Record<string, string>;
4197
- headers?: Record<string, string>;
4198
- credentialRef?: ProviderSourceCredentialRef;
4199
- [key: string]: unknown;
4200
- };
4201
- interface SkillSelection {
4202
- activeSkillSlugs: string[];
4203
- }
4204
- type CommandOrigin = {
4205
- type: 'user';
4206
- id?: string;
4207
- } | {
4208
- type: 'automation';
4209
- id: string;
4210
- } | {
4211
- type: 'scheduler';
4212
- id?: string;
4213
- } | {
4214
- type: 'host';
4215
- id?: string;
4216
- } | {
4217
- type: 'replay';
4218
- id?: string;
4219
- } | {
4220
- type: 'system';
4221
- id?: string;
4222
- };
4223
- interface SubmitPlanRequest {
4224
- sessionId?: string;
4225
- planRef: string;
4226
- origin?: CommandOrigin;
4227
- }
4228
- interface SubmitPlanReceipt {
4229
- accepted: boolean;
4230
- planRef?: string;
4231
- reason?: string;
4232
- }
4233
- interface SourceAuthRequest {
4234
- sessionId?: string;
4235
- sourceSlug: string;
4236
- reason?: string;
4237
- }
4238
- interface SourceAuthReceipt {
4239
- ok: boolean;
4240
- sourceSlug: string;
4241
- reason?: string;
4242
- }
4243
- interface SourceActivationRequest {
4244
- sessionId?: string;
4245
- sourceSlug: string;
4246
- }
4247
- interface SourceActivationReceipt {
4248
- ok: boolean;
4249
- sourceSlug: string;
4250
- availability?: 'immediate' | 'next-turn';
4251
- reason?: string;
4252
- }
4253
- interface BrowserActionRequest {
4254
- sessionId?: string;
4255
- action: string;
4256
- input?: unknown;
4257
- }
4258
- interface BrowserActionReceipt {
4259
- ok: boolean;
4260
- result?: unknown;
4261
- reason?: string;
4262
- }
4263
- interface SpawnSessionRequest {
4264
- parentSessionId?: string;
4265
- prompt: string;
4266
- model?: string;
4267
- commandOrigin?: CommandOrigin;
4268
- }
4269
- interface SpawnSessionReceipt {
4270
- sessionId: string;
4271
- }
4272
- interface InterSessionMessageRequest {
4273
- sessionId: string;
4274
- message: string;
4275
- attachments?: Array<{
4276
- path: string;
4277
- name?: string;
4278
- }>;
4279
- commandOrigin?: CommandOrigin;
4280
- }
4281
- interface CommandReceipt {
4282
- ok: boolean;
4283
- commandId?: string;
4284
- reason?: string;
4285
- }
4286
- interface SessionMetadataPatch {
4287
- sessionId?: string;
4288
- labels?: string[];
4289
- status?: string;
4290
- flagged?: boolean;
4291
- topic?: string;
4292
- }
4293
- interface SessionMetadataSnapshot {
4294
- sessionId?: string;
4295
- labels?: string[];
4296
- status?: string;
4297
- flagged?: boolean;
4298
- topic?: string;
4299
- }
4300
- interface SessionListRequest {
4301
- status?: string;
4302
- labels?: string[];
4303
- limit?: number;
4304
- }
4305
- interface SessionListResult {
4306
- sessions: SessionMetadataSnapshot[];
4307
- }
4308
- interface LlmToolRequest {
4309
- prompt: string;
4310
- model?: string;
4311
- commandOrigin?: CommandOrigin;
4312
- }
4313
- interface LlmToolResult {
4314
- text: string;
4315
- model?: string;
4316
- usage?: unknown;
4317
- }
4318
- interface ListSourcesRequest {
4319
- sessionId?: string;
4320
- enabledOnly?: boolean;
4321
- }
4322
- interface SourceSummary {
4323
- slug: string;
4324
- name: string;
4325
- provider: string;
4326
- type: string;
4327
- enabled: boolean;
4328
- isAuthenticated?: boolean;
4329
- connectionStatus?: string;
4330
- tagline?: string;
4331
- }
4332
- interface ListSourcesResult {
4333
- sources: SourceSummary[];
4334
- }
4335
- interface GetSourceRequest {
4336
- sessionId?: string;
4337
- sourceSlug: string;
4338
- }
4339
- interface GetSourceResult {
4340
- source: SourceSummary & {
4341
- createdAt?: number;
4342
- updatedAt?: number;
4343
- mcp?: Record<string, unknown>;
4344
- api?: Record<string, unknown>;
4345
- local?: Record<string, unknown>;
4346
- };
4347
- }
4348
- interface CreateSourceRequest {
4349
- sessionId?: string;
4350
- name: string;
4351
- provider: string;
4352
- type: string;
4353
- mcp?: Record<string, unknown>;
4354
- api?: Record<string, unknown>;
4355
- local?: Record<string, unknown>;
4356
- icon?: string;
4357
- enabled?: boolean;
4358
- }
4359
- interface CreateSourceResult {
4360
- ok: boolean;
4361
- source?: SourceSummary;
4362
- reason?: string;
4363
- }
4364
- interface UpdateSourceRequest {
4365
- sessionId?: string;
4366
- sourceSlug: string;
4367
- enabled?: boolean;
4368
- name?: string;
4369
- icon?: string;
4370
- tagline?: string;
4371
- }
4372
- interface UpdateSourceResult {
4373
- ok: boolean;
4374
- source?: SourceSummary;
4375
- reason?: string;
4376
- }
4377
- interface DeleteSourceRequest {
4378
- sessionId?: string;
4379
- sourceSlug: string;
4380
- }
4381
- interface DeleteSourceResult {
4382
- ok: boolean;
4383
- sourceSlug: string;
4384
- reason?: string;
4385
- }
4386
- interface ListSkillsRequest {
4387
- sessionId?: string;
4388
- }
4389
- interface SkillSummary {
4390
- slug: string;
4391
- name: string;
4392
- description: string;
4393
- source: string;
4394
- icon?: string;
4395
- globs?: string[];
4396
- requiredSources?: string[];
4397
- }
4398
- interface ListSkillsResult {
4399
- skills: SkillSummary[];
4400
- }
4401
- interface GetSkillRequest {
4402
- sessionId?: string;
4403
- skillSlug: string;
4404
- }
4405
- interface GetSkillResult {
4406
- skill: SkillSummary & {
4407
- content: string;
4408
- alwaysAllow?: string[];
4409
- };
4410
- }
4411
- interface CreateSkillRequest {
4412
- sessionId?: string;
4413
- slug: string;
4414
- name: string;
4415
- description: string;
4416
- content: string;
4417
- globs?: string[];
4418
- alwaysAllow?: string[];
4419
- icon?: string;
4420
- requiredSources?: string[];
4421
- }
4422
- interface CreateSkillResult {
4423
- ok: boolean;
4424
- skill?: SkillSummary;
4425
- reason?: string;
4426
- }
4427
- interface UpdateSkillRequest {
4428
- sessionId?: string;
4429
- skillSlug: string;
4430
- name?: string;
4431
- description?: string;
4432
- content?: string;
4433
- globs?: string[];
4434
- alwaysAllow?: string[];
4435
- icon?: string;
4436
- requiredSources?: string[];
4437
- }
4438
- interface UpdateSkillResult {
4439
- ok: boolean;
4440
- skill?: SkillSummary;
4441
- reason?: string;
4442
- }
4443
- interface DeleteSkillRequest {
4444
- sessionId?: string;
4445
- skillSlug: string;
4446
- }
4447
- interface DeleteSkillResult {
4448
- ok: boolean;
4449
- skillSlug: string;
4450
- reason?: string;
4451
- }
4452
- interface GetAutomationsConfigRequest {
4453
- sessionId?: string;
4454
- }
4455
- interface GetAutomationsConfigResult {
4456
- config: Record<string, unknown> | null;
4457
- configPath: string;
4458
- }
4459
- interface UpdateAutomationsConfigRequest {
4460
- sessionId?: string;
4461
- config: Record<string, unknown>;
4462
- }
4463
- interface UpdateAutomationsConfigResult {
4464
- ok: boolean;
4465
- automationCount?: number;
4466
- errors?: string[];
4467
- }
4468
- interface ListSchedulesRequest {
4469
- sessionId?: string;
4470
- }
4471
- interface ScheduleSummary {
4472
- schedulerId: string;
4473
- workspaceId: string;
4474
- cron: string;
4475
- timezone: string;
4476
- }
4477
- interface ListSchedulesResult {
4478
- schedules: ScheduleSummary[];
4479
- }
4480
- interface StartScheduleRequest {
4481
- sessionId?: string;
4482
- schedulerId: string;
4483
- workspaceId: string;
4484
- cron: string;
4485
- timezone: string;
4486
- }
4487
- interface StartScheduleResult {
4488
- schedulerId: string;
4489
- state: 'started' | 'stopped';
4490
- timestamp: number;
4491
- }
4492
- interface StopScheduleRequest {
4493
- sessionId?: string;
4494
- schedulerId: string;
4495
- }
4496
- interface StopScheduleResult {
4497
- ok: boolean;
4498
- schedulerId: string;
4499
- state?: 'stopped';
4500
- reason?: string;
4501
- }
4502
- interface SessionToolBridge {
4503
- submitPlan?(request: SubmitPlanRequest): Promise<SubmitPlanReceipt>;
4504
- requestSourceAuth?(request: SourceAuthRequest): Promise<SourceAuthReceipt>;
4505
- activateSource?(request: SourceActivationRequest): Promise<SourceActivationReceipt>;
4506
- runBrowserAction?(request: BrowserActionRequest): Promise<BrowserActionReceipt>;
4507
- spawnSession?(request: SpawnSessionRequest): Promise<SpawnSessionReceipt>;
4508
- sendSessionMessage?(request: InterSessionMessageRequest): Promise<CommandReceipt>;
4509
- updateSessionMetadata?(request: SessionMetadataPatch): Promise<SessionMetadataSnapshot>;
4510
- listSessions?(request: SessionListRequest): Promise<SessionListResult>;
4511
- queryLlm?(request: LlmToolRequest): Promise<LlmToolResult>;
4512
- listSources?(request: ListSourcesRequest): Promise<ListSourcesResult>;
4513
- getSource?(request: GetSourceRequest): Promise<GetSourceResult>;
4514
- createSource?(request: CreateSourceRequest): Promise<CreateSourceResult>;
4515
- updateSource?(request: UpdateSourceRequest): Promise<UpdateSourceResult>;
4516
- deleteSource?(request: DeleteSourceRequest): Promise<DeleteSourceResult>;
4517
- listSkills?(request: ListSkillsRequest): Promise<ListSkillsResult>;
4518
- getSkill?(request: GetSkillRequest): Promise<GetSkillResult>;
4519
- createSkill?(request: CreateSkillRequest): Promise<CreateSkillResult>;
4520
- updateSkill?(request: UpdateSkillRequest): Promise<UpdateSkillResult>;
4521
- deleteSkill?(request: DeleteSkillRequest): Promise<DeleteSkillResult>;
4522
- getAutomationsConfig?(request: GetAutomationsConfigRequest): Promise<GetAutomationsConfigResult>;
4523
- updateAutomationsConfig?(request: UpdateAutomationsConfigRequest): Promise<UpdateAutomationsConfigResult>;
4524
- listSchedules?(request: ListSchedulesRequest): Promise<ListSchedulesResult>;
4525
- startSchedule?(request: StartScheduleRequest): Promise<StartScheduleResult>;
4526
- stopSchedule?(request: StopScheduleRequest): Promise<StopScheduleResult>;
4527
- }
4528
- type SessionToolName = keyof SessionToolBridge;
4529
- type SessionToolRequest = SubmitPlanRequest | SourceAuthRequest | SourceActivationRequest | BrowserActionRequest | SpawnSessionRequest | InterSessionMessageRequest | SessionMetadataPatch | SessionListRequest | LlmToolRequest | ListSourcesRequest | GetSourceRequest | CreateSourceRequest | UpdateSourceRequest | DeleteSourceRequest | ListSkillsRequest | GetSkillRequest | CreateSkillRequest | UpdateSkillRequest | DeleteSkillRequest | GetAutomationsConfigRequest | UpdateAutomationsConfigRequest | ListSchedulesRequest | StartScheduleRequest | StopScheduleRequest;
4530
- interface SessionToolTimelineRef {
4531
- epoch: string;
4532
- seq: number;
4533
- }
4534
- interface SessionToolInvocationReceipt {
4535
- ok: boolean;
4536
- requestId: string;
4537
- toolName: SessionToolName;
4538
- origin?: CommandOrigin;
4539
- policyDecision: ToolPolicyDecision;
4540
- result?: unknown;
4541
- reason?: string;
4542
- timelineRefs: SessionToolTimelineRef[];
4543
- }
4544
- interface InvokeSessionToolOptions {
4545
- sessionId: string;
4546
- toolName: SessionToolName;
4547
- request: SessionToolRequest;
4548
- bridge: SessionToolBridge;
4549
- policy?: RuntimePolicyHook;
4550
- commandOrigin?: CommandOrigin;
4551
- appendTimeline?: (item: TimelineItem) => TimelineEnvelope;
4552
- }
4553
- interface RuntimeHostServices {
4554
- sessionTools?: SessionToolBridge;
4555
- }
4556
- interface RuntimeExtensionContext {
4557
- policy?: RuntimePolicyExtension;
4558
- sources?: SourceSelection;
4559
- skills?: SkillSelection;
4560
- commandOrigin?: CommandOrigin;
4561
- hostServices?: RuntimeHostServices;
4562
- }
4563
- interface AgentCommandSink {
4564
- sendMessage(message: string, options?: SendMessageOptions): Promise<void>;
4565
- abort(reason?: string): Promise<void>;
4566
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4567
- resumeTool?(runId: string, resumeData: Record<string, unknown>): Promise<void>;
4568
- dispose(): Promise<void>;
4569
- }
4570
- interface AgentEventStream {
4571
- connect(onEvent: (event: AgentEvent) => void, onError?: (error: Error) => void, onClose?: () => void): void;
4572
- disconnect(): void;
4573
- isConnected(): boolean;
4574
- }
4575
- interface AgentTimelineStream {
4576
- connect(onEvent: (event: TimelineEnvelope) => void, onError?: (error: Error) => void, onClose?: () => void): void;
4577
- disconnect(): void;
4578
- isConnected(): boolean;
4579
- }
4580
- interface AgentRuntimeState {
4581
- status: AgentRuntimeStatus;
4582
- acceptedMessages: string[];
4583
- queuedMessages: string[];
4584
- lastError?: string;
4585
- waitingPermissionRequestId?: string;
4586
- }
4587
- type RuntimeAction = {
4588
- type: 'preflight_start';
4589
- } | {
4590
- type: 'preflight_ok';
4591
- } | {
4592
- type: 'preflight_error';
4593
- error: string;
4594
- } | {
4595
- type: 'starting';
4596
- } | {
4597
- type: 'send_message';
4598
- message: string;
4599
- } | {
4600
- type: 'permission_request';
4601
- requestId: string;
4602
- } | {
4603
- type: 'permission_response';
4604
- } | {
4605
- type: 'turn_completed';
4606
- } | {
4607
- type: 'complete';
4608
- } | {
4609
- type: 'abort';
4610
- reason?: string;
4611
- } | {
4612
- type: 'error';
4613
- error: string;
4614
- } | {
4615
- type: 'dispose';
4616
- };
4617
- declare const initialRuntimeState: AgentRuntimeState;
4618
- /**
4619
- * Canonical state machine reducer for AgentRuntime lifecycle.
4620
- *
4621
- * Transitions follow the architecture spec:
4622
- * idle → preflighting → ready → starting → running
4623
- * running → waiting_for_permission → running
4624
- * running → turn_completed → ready
4625
- * running → ready (via complete with empty queue)
4626
- * any → failed / disposed
4627
- * any non-disposed → ready (via abort)
4628
- *
4629
- * `send_message` while running enqueues (session manager semantics).
4630
- * `complete` drains the queue: if a queued message exists, it is
4631
- * immediately accepted and the state stays running.
4632
- */
4633
- declare function reduceRuntimeState(state: AgentRuntimeState | undefined, action: RuntimeAction): AgentRuntimeState;
4634
- interface AgentRuntime {
4635
- readonly sessionId: string;
4636
- readonly provider: string;
4637
- readonly runtimeKind: AgentRuntimeKind;
4638
- readonly events: AgentTimelineStream;
4639
- readonly commands: AgentCommandSink;
4640
- preflight(): Promise<RuntimeCapabilityReport>;
4641
- fetchTimeline(request: TimelineFetchRequest): Promise<TimelineFetchResult>;
4642
- getState(): AgentRuntimeState;
4643
- }
4644
- declare function createRuntimeExtensionContext(context?: RuntimeExtensionContext): RuntimeExtensionContext;
4645
- declare function sanitizeProviderSourceTools(sourceTools: ProviderSourceToolDescriptor[] | undefined): ProviderSourceToolDescriptor[];
4646
- declare function invokeSessionTool(options: InvokeSessionToolOptions): Promise<SessionToolInvocationReceipt>;
4647
- declare function selectRuntimeCandidate(options: RuntimeSelectionOptions): RuntimeSelection;
4648
- declare function createRuntimeCapabilityReport(options: CreateRuntimeCapabilityReportOptions): RuntimeCapabilityReport;
4649
-
4650
- 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 };
4651
-
4652
- // ── inlined from @weft/local-chat ──
4653
- // -- @weft/local-chat/index.d.ts --
4654
- import * as react_jsx_runtime from 'react/jsx-runtime';
4655
-
4656
- interface LocalChatAuthDetection {
4657
- provider: string;
4658
- configured: boolean;
4659
- source?: string;
4660
- error?: string;
4661
- }
4662
- interface LocalChatRuntimeState {
4663
- status: 'idle' | 'preflighting' | 'running' | 'ready' | 'failed' | string;
4664
- }
4665
- interface LocalChatEventSource {
4666
- connect(onEvent: (event: AgentEvent) => void, onError?: (error: Error) => void, onClose?: () => void): void;
4667
- disconnect(): void;
4668
- isConnected(): boolean;
4669
- }
4670
- interface LocalChatCommandSink {
4671
- sendMessage(message: string): Promise<void>;
4672
- abort(reason?: string): Promise<void>;
4673
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4674
- }
4675
- interface LocalChatSessionRuntime {
4676
- sessionId: string;
4677
- provider: string;
4678
- events: LocalChatEventSource;
4679
- commands: LocalChatCommandSink;
4680
- preflight(): Promise<LocalChatAuthDetection>;
4681
- getState(): LocalChatRuntimeState;
4682
- }
4683
- interface AgentChatSessionModel {
4684
- session: Session | null;
4685
- turns: Turn[];
4686
- isRunning: boolean;
4687
- auth: LocalChatAuthDetection | null;
4688
- error: Error | null;
4689
- sendMessage(message: string): Promise<void>;
4690
- abort(): Promise<void>;
4691
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4692
- }
4693
- interface UseAgentChatSessionOptions {
4694
- runtime: LocalChatSessionRuntime;
4695
- workspaceId?: string;
4696
- workspaceName?: string;
4697
- }
4698
- interface TimelineChatPanelModel {
4699
- session: Session;
4700
- turns: Turn[];
4701
- }
4702
- type TimelineDetailKind = 'permission' | 'runtime' | 'source' | 'skill' | 'automation' | 'host' | 'tool';
4703
- interface TimelineDetailItem {
4704
- id: string;
4705
- kind: TimelineDetailKind;
4706
- title: string;
4707
- summary?: string;
4708
- status?: string;
4709
- timestamp: number;
4710
- detail: unknown;
4711
- envelope: TimelineEnvelope;
4712
- }
4713
- interface TimelineAgentChatSessionModel extends TimelineChatPanelModel {
4714
- timeline: TimelineEnvelope[];
4715
- isRunning: boolean;
4716
- isConnected: boolean;
4717
- isReconnecting: boolean;
4718
- hasGap: boolean;
4719
- capabilityReport: RuntimeCapabilityReport | null;
4720
- error: Error | null;
4721
- sendMessage(message: string, options?: SendMessageOptions): Promise<void>;
4722
- abort(): Promise<void>;
4723
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4724
- }
4725
- interface UseTimelineAgentChatSessionOptions {
4726
- runtime: AgentRuntime;
4727
- workspaceId?: string;
4728
- workspaceName?: string;
4729
- }
4730
- declare function createAgentChatPanelModel(args: {
4731
- session: Session | null;
4732
- runtime: LocalChatSessionRuntime;
4733
- auth?: LocalChatAuthDetection | null;
4734
- error?: Error | null;
4735
- }): Pick<AgentChatSessionModel, 'turns' | 'isRunning' | 'auth' | 'error'>;
4736
- declare function createAgentChatPanelModelFromTimeline(args: {
4737
- timeline: TimelineEnvelope[];
4738
- sessionId: string;
4739
- workspaceId: string;
4740
- workspaceName?: string;
4741
- }): TimelineChatPanelModel;
4742
- declare function createTimelineAgentChatPanelModel(args: {
4743
- timeline: TimelineEnvelope[];
4744
- sessionId: string;
4745
- workspaceId: string;
4746
- workspaceName?: string;
4747
- runtimeState: AgentRuntimeState;
4748
- capabilityReport: RuntimeCapabilityReport | null;
4749
- error: Error | null;
4750
- }): Pick<TimelineAgentChatSessionModel, 'session' | 'turns' | 'isRunning' | 'capabilityReport' | 'error'>;
4751
- declare function createTimelineDetailItems(timeline: TimelineEnvelope[]): TimelineDetailItem[];
4752
- declare function useAgentChatSession(options: UseAgentChatSessionOptions): AgentChatSessionModel;
4753
- declare function useTimelineAgentChatSession(options: UseTimelineAgentChatSessionOptions): TimelineAgentChatSessionModel;
4754
-
4755
- interface AgentChatPanelProps {
4756
- runtime: LocalChatSessionRuntime;
4757
- workspaceId?: string;
4758
- workspaceName?: string;
4759
- platformActions?: PlatformActions;
4760
- placeholder?: string;
4761
- className?: string;
4762
- }
4763
- declare function AgentChatPanel({ runtime, workspaceId, workspaceName, platformActions, placeholder, className, }: AgentChatPanelProps): react_jsx_runtime.JSX.Element;
4764
-
4765
- interface TimelineAgentChatPanelProps {
4766
- /** Agent runtime instance from runtime-core */
4767
- runtime: AgentRuntime;
4768
- /** Workspace identifier */
4769
- workspaceId?: string;
4770
- /** Workspace display name */
4771
- workspaceName?: string;
4772
- /** Platform actions for file/URL handling */
4773
- platformActions?: PlatformActions;
4774
- /** Placeholder text for the input area */
4775
- placeholder?: string;
4776
- /** Whether to show the runtime status bar */
4777
- showStatusBar?: boolean;
4778
- /** Whether to show the runtime detail sidebar panel */
4779
- showDetailPanel?: boolean;
4780
- /** Additional className */
4781
- className?: string;
4782
- }
4783
- declare function TimelineAgentChatPanel({ runtime, workspaceId, workspaceName, platformActions, placeholder, showStatusBar, showDetailPanel, className, }: TimelineAgentChatPanelProps): react_jsx_runtime.JSX.Element;
4784
-
4785
- /**
4786
- * Find the active (unresolved) permission request from timeline envelopes.
4787
- *
4788
- * Walks the timeline backwards to find the most recent permission_requested
4789
- * envelope that has not been resolved by a matching permission_resolved.
4790
- */
4791
- declare function findActivePermissionRequest(timeline: TimelineEnvelope[]): {
4792
- requestId: string;
4793
- toolName: string;
4794
- input?: Record<string, unknown>;
4795
- reason?: string;
4796
- scope?: {
4797
- type: string;
4798
- label?: string;
4799
- };
4800
- } | null;
4801
-
4802
- /**
4803
- * Convert a processor Session (returned by useAgentChatSession) into a
4804
- * StoredSession that SessionViewer can render.
4805
- *
4806
- * Consumers embedding AgentChatPanel don't need this — it's called internally.
4807
- * This utility is exported for consumers who use useAgentChatSession directly
4808
- * and build their own panel around SessionViewer.
4809
- */
4810
- declare function toStoredSession(session: Session, fallbackWorkspaceId?: string): StoredSession;
4811
- /**
4812
- * Build an empty StoredSession placeholder for the initial state
4813
- * before the event processor has received any events.
4814
- */
4815
- declare function createEmptyStoredSession(sessionId: string, workspaceId?: string, workspaceName?: string): StoredSession;
4816
-
4817
- export { AgentChatPanel, type AgentChatPanelProps, type AgentChatSessionModel, type LocalChatAuthDetection, type LocalChatCommandSink, type LocalChatEventSource, type LocalChatRuntimeState, type LocalChatSessionRuntime, TimelineAgentChatPanel, type TimelineAgentChatPanelProps, type TimelineAgentChatSessionModel, type TimelineChatPanelModel, type TimelineDetailItem, type TimelineDetailKind, type UseAgentChatSessionOptions, type UseTimelineAgentChatSessionOptions, createAgentChatPanelModel, createAgentChatPanelModelFromTimeline, createEmptyStoredSession, createTimelineAgentChatPanelModel, createTimelineDetailItems, findActivePermissionRequest, toStoredSession, useAgentChatSession, useTimelineAgentChatSession };