@theokit/agents 3.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bridge-entry-8gsH0kVZ.d.ts → bridge-entry-Ddu3Ug_3.d.ts} +33 -17
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +5 -5
- package/dist/{chunk-C2DALG62.js → chunk-OKG5LRGV.js} +29 -18
- package/dist/chunk-OKG5LRGV.js.map +1 -0
- package/dist/index.d.ts +97 -20
- package/dist/index.js +217 -119
- package/dist/index.js.map +1 -1
- package/dist/interactive.d.ts +4 -0
- package/dist/interactive.js +3 -0
- package/dist/interactive.js.map +1 -0
- package/dist/persistence.d.ts +1 -0
- package/dist/persistence.js +3 -0
- package/dist/persistence.js.map +1 -0
- package/dist/pty.d.ts +1 -0
- package/dist/pty.js +3 -0
- package/dist/pty.js.map +1 -0
- package/dist/sandbox.d.ts +1 -0
- package/dist/sandbox.js +3 -0
- package/dist/sandbox.js.map +1 -0
- package/package.json +26 -5
- package/dist/chunk-C2DALG62.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AGENT_BRAND,
|
|
3
|
+
AgentBuilder,
|
|
3
4
|
AgentDefinitionError,
|
|
4
5
|
AgentRunner,
|
|
5
6
|
AgentRunnerBuilder,
|
|
6
7
|
BudgetExceededError,
|
|
7
8
|
ConfigurationError,
|
|
9
|
+
ContextualTool,
|
|
8
10
|
CostBudgetExceededError,
|
|
9
11
|
DEFAULT_KEEP_TOKENS,
|
|
10
12
|
DEFAULT_MAX_ITERATIONS,
|
|
11
13
|
DelegationError,
|
|
12
14
|
GuardrailViolationError,
|
|
13
|
-
agent,
|
|
14
15
|
agentsPlugin,
|
|
15
16
|
buildModelSelection,
|
|
16
17
|
compactionStrategyConfigSchema,
|
|
@@ -22,7 +23,6 @@ import {
|
|
|
22
23
|
compileSkills,
|
|
23
24
|
compileSkillsSelection,
|
|
24
25
|
compileTools,
|
|
25
|
-
contextualTool,
|
|
26
26
|
costGuard,
|
|
27
27
|
createAgentExecutionContext,
|
|
28
28
|
createApiErrorHandler,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
toolRuntimeName,
|
|
71
71
|
translateSdkEvent,
|
|
72
72
|
unicodeNormalizer
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-OKG5LRGV.js";
|
|
74
74
|
import {
|
|
75
75
|
__name
|
|
76
76
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -177,66 +177,71 @@ var ToolsCapability = class {
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
|
-
var
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
if (typeof e !== "object" || e === null || Array.isArray(e)) {
|
|
192
|
-
throw new ConfigurationError(`skills: entrada inv\xE1lida (${describe(e)}) \u2014 use um nome ou um skill inline`);
|
|
180
|
+
var SkillsCapability = class {
|
|
181
|
+
static {
|
|
182
|
+
__name(this, "SkillsCapability");
|
|
183
|
+
}
|
|
184
|
+
name = "skills";
|
|
185
|
+
#entries;
|
|
186
|
+
constructor(entries) {
|
|
187
|
+
if (!Array.isArray(entries)) {
|
|
188
|
+
throw new ConfigurationError(`skills: esperava array de nomes, recebi ${describe(entries)}`);
|
|
193
189
|
}
|
|
194
|
-
for (const
|
|
195
|
-
"
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
190
|
+
for (const e of entries) {
|
|
191
|
+
if (typeof e === "string") {
|
|
192
|
+
if (e.trim().length === 0) {
|
|
193
|
+
throw new ConfigurationError("skills: nome vazio \u2014 use um nome de skill n\xE3o vazio");
|
|
194
|
+
}
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (typeof e !== "object" || e === null || Array.isArray(e)) {
|
|
198
|
+
throw new ConfigurationError(`skills: entrada inv\xE1lida (${describe(e)}) \u2014 use um nome ou um skill inline`);
|
|
199
|
+
}
|
|
200
|
+
for (const field of [
|
|
201
|
+
"name",
|
|
202
|
+
"description",
|
|
203
|
+
"instructions"
|
|
204
|
+
]) {
|
|
205
|
+
const value = e[field];
|
|
206
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
207
|
+
throw new ConfigurationError(`skills: skill inline sem \`${field}\` v\xE1lido (${describe(value)}) \u2014 name, description e instructions s\xE3o obrigat\xF3rios`);
|
|
208
|
+
}
|
|
202
209
|
}
|
|
203
210
|
}
|
|
211
|
+
this.#entries = entries;
|
|
204
212
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
...
|
|
220
|
-
enabled
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
inline
|
|
226
|
-
...previous.inline ?? [],
|
|
227
|
-
...compiled.skills.inline ?? []
|
|
228
|
-
]
|
|
229
|
-
} : {}
|
|
230
|
-
};
|
|
231
|
-
draft.provenance.push({
|
|
232
|
-
capability: "skills",
|
|
233
|
-
contributed: [
|
|
234
|
-
"skills"
|
|
213
|
+
apply(draft) {
|
|
214
|
+
const compiled = compileSkillsSelection(this.#entries.slice());
|
|
215
|
+
if (compiled.skills === void 0) return;
|
|
216
|
+
const previous = draft.skills;
|
|
217
|
+
draft.skills = previous === void 0 ? compiled.skills : {
|
|
218
|
+
// The spread is exhaustive only because `compileSkillsSelection` emits a FIXED 3-key
|
|
219
|
+
// shape (`enabled`, `autoInject: true`, and `inline` iff non-empty) — `enabled` and
|
|
220
|
+
// `inline` are both re-derived below, and `autoInject` is the same literal on both
|
|
221
|
+
// sides. TRAP for the future: if a capability ever authors `autoInject: false`, this
|
|
222
|
+
// spread would silently normalize it back to `true`. Unreachable today (no capability
|
|
223
|
+
// and no reference array form can express it) — revisit when one can.
|
|
224
|
+
...previous,
|
|
225
|
+
...compiled.skills,
|
|
226
|
+
enabled: [
|
|
227
|
+
...previous.enabled ?? [],
|
|
228
|
+
...compiled.skills.enabled ?? []
|
|
229
|
+
],
|
|
230
|
+
...previous.inline !== void 0 || compiled.skills.inline !== void 0 ? {
|
|
231
|
+
inline: [
|
|
232
|
+
...previous.inline ?? [],
|
|
233
|
+
...compiled.skills.inline ?? []
|
|
235
234
|
]
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
} : {}
|
|
236
|
+
};
|
|
237
|
+
draft.provenance.push({
|
|
238
|
+
capability: this.name,
|
|
239
|
+
contributed: [
|
|
240
|
+
"skills"
|
|
241
|
+
]
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
};
|
|
240
245
|
|
|
241
246
|
// src/capability/registry.ts
|
|
242
247
|
var UnknownCapabilityError = class extends Error {
|
|
@@ -287,62 +292,147 @@ var CapabilityPreset = class {
|
|
|
287
292
|
};
|
|
288
293
|
|
|
289
294
|
// src/capability/agent-capabilities.ts
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
var
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
295
|
+
var FieldCapability = class {
|
|
296
|
+
static {
|
|
297
|
+
__name(this, "FieldCapability");
|
|
298
|
+
}
|
|
299
|
+
value;
|
|
300
|
+
constructor(value) {
|
|
301
|
+
this.value = value;
|
|
302
|
+
}
|
|
303
|
+
apply(draft) {
|
|
304
|
+
setOnce(draft, this.field, this.value, this.name);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
var MemoryCapability = class extends FieldCapability {
|
|
308
|
+
static {
|
|
309
|
+
__name(this, "MemoryCapability");
|
|
310
|
+
}
|
|
311
|
+
name = "memory";
|
|
312
|
+
field = "memory";
|
|
313
|
+
};
|
|
314
|
+
var ContextWindowCapability = class {
|
|
315
|
+
static {
|
|
316
|
+
__name(this, "ContextWindowCapability");
|
|
317
|
+
}
|
|
318
|
+
options;
|
|
319
|
+
name = "context-window";
|
|
320
|
+
constructor(options) {
|
|
321
|
+
this.options = options;
|
|
322
|
+
}
|
|
323
|
+
apply(draft) {
|
|
324
|
+
setOnce(draft, "context", compileContextWindow(this.options).context, this.name);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
var ProjectContextCapability = class extends FieldCapability {
|
|
328
|
+
static {
|
|
329
|
+
__name(this, "ProjectContextCapability");
|
|
330
|
+
}
|
|
331
|
+
name = "project-context";
|
|
332
|
+
field = "projectContext";
|
|
333
|
+
};
|
|
334
|
+
var McpServersCapability = class extends FieldCapability {
|
|
335
|
+
static {
|
|
336
|
+
__name(this, "McpServersCapability");
|
|
337
|
+
}
|
|
338
|
+
name = "mcp";
|
|
339
|
+
field = "mcpServers";
|
|
340
|
+
};
|
|
341
|
+
var GuardrailsCapability = class extends FieldCapability {
|
|
342
|
+
static {
|
|
343
|
+
__name(this, "GuardrailsCapability");
|
|
344
|
+
}
|
|
345
|
+
name = "guardrails";
|
|
346
|
+
field = "guardrails";
|
|
347
|
+
};
|
|
348
|
+
var CheckpointCapability = class {
|
|
349
|
+
static {
|
|
350
|
+
__name(this, "CheckpointCapability");
|
|
351
|
+
}
|
|
352
|
+
options;
|
|
353
|
+
name = "checkpoint";
|
|
354
|
+
constructor(options) {
|
|
355
|
+
this.options = options;
|
|
356
|
+
}
|
|
357
|
+
apply(draft) {
|
|
358
|
+
if (this.options !== void 0 && this.options.storage !== "filesystem") {
|
|
359
|
+
console.warn(`[THEO_AGENT_CHECKPOINT_STORAGE_METADATA_ONLY] checkpoint({ storage: '${this.options.storage ?? "memory"}' }) does NOT resume across requests \u2014 only 'filesystem' selects the SDK's durable conversation store. Use checkpoint({ storage: 'filesystem' }) for cross-request resume.`);
|
|
314
360
|
}
|
|
315
|
-
setOnce(draft, "checkpoint", options,
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
var
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
361
|
+
setOnce(draft, "checkpoint", this.options, this.name);
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
var HumanInTheLoopCapability = class extends FieldCapability {
|
|
365
|
+
static {
|
|
366
|
+
__name(this, "HumanInTheLoopCapability");
|
|
367
|
+
}
|
|
368
|
+
name = "human-in-the-loop";
|
|
369
|
+
field = "hitl";
|
|
370
|
+
};
|
|
371
|
+
var SubAgentsCapability = class {
|
|
372
|
+
static {
|
|
373
|
+
__name(this, "SubAgentsCapability");
|
|
374
|
+
}
|
|
375
|
+
children;
|
|
376
|
+
name = "sub-agents";
|
|
377
|
+
constructor(children) {
|
|
378
|
+
this.children = children;
|
|
379
|
+
}
|
|
380
|
+
apply(draft) {
|
|
381
|
+
for (const [name, child] of Object.entries(this.children)) {
|
|
323
382
|
if (name in draft.agents && draft.agents[name] !== child) {
|
|
324
383
|
throw new ConfigurationError(`sub-agents: filho "${name}" declarado duas vezes com defini\xE7\xF5es diferentes`);
|
|
325
384
|
}
|
|
326
385
|
draft.agents[name] = child;
|
|
327
386
|
}
|
|
328
387
|
draft.provenance.push({
|
|
329
|
-
capability:
|
|
388
|
+
capability: this.name,
|
|
330
389
|
contributed: [
|
|
331
390
|
"agents"
|
|
332
391
|
]
|
|
333
392
|
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
var
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
var SkillsOptionsCapability = class {
|
|
396
|
+
static {
|
|
397
|
+
__name(this, "SkillsOptionsCapability");
|
|
398
|
+
}
|
|
399
|
+
options;
|
|
400
|
+
name = "skills";
|
|
401
|
+
constructor(options) {
|
|
402
|
+
this.options = options;
|
|
403
|
+
}
|
|
404
|
+
apply(draft) {
|
|
405
|
+
setOnce(draft, "skills", compileSkills(this.options), this.name);
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
var SettingSourcesCapability = class extends FieldCapability {
|
|
409
|
+
static {
|
|
410
|
+
__name(this, "SettingSourcesCapability");
|
|
411
|
+
}
|
|
412
|
+
name = "setting-sources";
|
|
413
|
+
field = "settingSources";
|
|
414
|
+
};
|
|
415
|
+
var PluginsCapability = class extends FieldCapability {
|
|
416
|
+
static {
|
|
417
|
+
__name(this, "PluginsCapability");
|
|
418
|
+
}
|
|
419
|
+
name = "plugins";
|
|
420
|
+
field = "plugins";
|
|
421
|
+
};
|
|
422
|
+
var RunContextCapability = class extends FieldCapability {
|
|
423
|
+
static {
|
|
424
|
+
__name(this, "RunContextCapability");
|
|
425
|
+
}
|
|
426
|
+
name = "run-context";
|
|
427
|
+
field = "runContext";
|
|
428
|
+
};
|
|
429
|
+
var SkillsResolverCapability = class extends FieldCapability {
|
|
430
|
+
static {
|
|
431
|
+
__name(this, "SkillsResolverCapability");
|
|
432
|
+
}
|
|
433
|
+
name = "skills-resolver";
|
|
434
|
+
field = "skillsResolver";
|
|
435
|
+
};
|
|
346
436
|
var AgentConfigCapability = class {
|
|
347
437
|
static {
|
|
348
438
|
__name(this, "AgentConfigCapability");
|
|
@@ -769,10 +859,15 @@ var AcpClient = class {
|
|
|
769
859
|
}
|
|
770
860
|
}
|
|
771
861
|
};
|
|
862
|
+
|
|
863
|
+
// src/index.ts
|
|
864
|
+
import { Agent, Squad, Tool, Provider } from "@theokit/sdk";
|
|
772
865
|
export {
|
|
773
866
|
AGENT_BRAND,
|
|
774
867
|
AcpClient,
|
|
775
868
|
AcpMessageDecoder,
|
|
869
|
+
Agent,
|
|
870
|
+
AgentBuilder,
|
|
776
871
|
AgentConfigCapability,
|
|
777
872
|
AgentDefinitionError,
|
|
778
873
|
AgentRunner,
|
|
@@ -781,25 +876,42 @@ export {
|
|
|
781
876
|
CapabilityConflictError,
|
|
782
877
|
CapabilityPreset,
|
|
783
878
|
CapabilityRegistry,
|
|
879
|
+
CheckpointCapability,
|
|
784
880
|
ConfigurationError,
|
|
881
|
+
ContextWindowCapability,
|
|
882
|
+
ContextualTool,
|
|
785
883
|
CostBudgetExceededError,
|
|
786
884
|
DEFAULT_KEEP_TOKENS,
|
|
787
885
|
DEFAULT_MAX_ITERATIONS,
|
|
788
886
|
DelegationError,
|
|
887
|
+
FieldCapability,
|
|
789
888
|
GuardrailViolationError,
|
|
889
|
+
GuardrailsCapability,
|
|
890
|
+
HumanInTheLoopCapability,
|
|
790
891
|
MCP_PROTOCOL_VERSION,
|
|
791
892
|
MainLoopCapability,
|
|
893
|
+
McpServersCapability,
|
|
894
|
+
MemoryCapability,
|
|
792
895
|
ModelCapability,
|
|
896
|
+
PluginsCapability,
|
|
897
|
+
ProjectContextCapability,
|
|
898
|
+
Provider,
|
|
899
|
+
RunContextCapability,
|
|
900
|
+
SettingSourcesCapability,
|
|
901
|
+
SkillsCapability,
|
|
902
|
+
SkillsOptionsCapability,
|
|
903
|
+
SkillsResolverCapability,
|
|
904
|
+
Squad,
|
|
905
|
+
SubAgentsCapability,
|
|
906
|
+
Tool,
|
|
793
907
|
ToolboxCapability,
|
|
794
908
|
ToolsCapability,
|
|
795
909
|
UnknownCapabilityError,
|
|
796
|
-
agent,
|
|
797
910
|
agentsPlugin,
|
|
798
911
|
applyCapabilities,
|
|
799
912
|
buildAgentCard,
|
|
800
913
|
buildMcpToolDescriptors,
|
|
801
914
|
buildModelSelection,
|
|
802
|
-
checkpoint,
|
|
803
915
|
compactionStrategyConfigSchema,
|
|
804
916
|
compileAgentDefinition,
|
|
805
917
|
compileAgentModule,
|
|
@@ -807,8 +919,6 @@ export {
|
|
|
807
919
|
compileProjectContext,
|
|
808
920
|
compileSkills,
|
|
809
921
|
compileTools,
|
|
810
|
-
contextWindow,
|
|
811
|
-
contextualTool,
|
|
812
922
|
costGuard,
|
|
813
923
|
createA2ATool,
|
|
814
924
|
createAgentExecutionContext,
|
|
@@ -826,8 +936,6 @@ export {
|
|
|
826
936
|
extractThinkTagStream,
|
|
827
937
|
generateAgentManifest,
|
|
828
938
|
generateAgentRoutes,
|
|
829
|
-
guardrails,
|
|
830
|
-
humanInTheLoop,
|
|
831
939
|
isAgentContext,
|
|
832
940
|
isAgentDefinition,
|
|
833
941
|
isApprovalRequired,
|
|
@@ -841,17 +949,13 @@ export {
|
|
|
841
949
|
loopStrategyConfigSchema,
|
|
842
950
|
mcpRegistry,
|
|
843
951
|
mcpServerInfo,
|
|
844
|
-
mcpServers,
|
|
845
952
|
mcpToolApprovals,
|
|
846
|
-
memory,
|
|
847
953
|
moderateOutputStream,
|
|
848
954
|
noopReflectionStrategy,
|
|
849
955
|
outputModeration,
|
|
850
956
|
parseConversationId,
|
|
851
957
|
piiDetector,
|
|
852
|
-
plugins,
|
|
853
958
|
presentUIMessageStream,
|
|
854
|
-
projectContext,
|
|
855
959
|
projectContextMetadataOnlyKnobs,
|
|
856
960
|
promptInjectionDetector,
|
|
857
961
|
reflectionStrategyConfigSchema,
|
|
@@ -859,18 +963,12 @@ export {
|
|
|
859
963
|
resolveEnabledSkills,
|
|
860
964
|
resolveLoopStrategy,
|
|
861
965
|
resolveMcpServers,
|
|
862
|
-
runContext,
|
|
863
966
|
runInputGuards,
|
|
864
967
|
runOutputGuards,
|
|
865
968
|
runWithApiErrorHandling,
|
|
866
969
|
setOnce,
|
|
867
|
-
settingSources,
|
|
868
|
-
skills,
|
|
869
|
-
skillsOptions,
|
|
870
|
-
skillsResolver,
|
|
871
970
|
streamAgentResponse,
|
|
872
971
|
streamAgentUIMessages,
|
|
873
|
-
subAgents,
|
|
874
972
|
toAgentFactory,
|
|
875
973
|
tokenBudgetCompactionStrategy,
|
|
876
974
|
translateSdkEvent,
|