@theokit/sdk 3.1.0 → 3.2.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/CHANGELOG.md +16 -0
- package/dist/a2a/index.cjs +166 -44
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +166 -44
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-C2jWAvlQ.d.cts → cron-4u1UdmgC.d.cts} +1 -1
- package/dist/{cron-BLRe166v.d.ts → cron-DuhVPer6.d.ts} +1 -1
- package/dist/cron.cjs +152 -35
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +152 -35
- package/dist/cron.js.map +1 -1
- package/dist/{errors-D_Bfo30u.d.ts → errors-_fPS0X80.d.ts} +1 -1
- package/dist/{errors-DZpCGlYv.d.cts → errors-jxK4yfp5.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +152 -35
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +152 -35
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +152 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +152 -35
- package/dist/index.js.map +1 -1
- package/dist/internal/runtime/context/context-discovery.d.ts +1 -1
- package/dist/internal/runtime/context/context-glob.d.ts +1 -0
- package/dist/internal/runtime/context/context-manager.d.ts +18 -1
- package/dist/internal/runtime/context/context-mdc-parser.d.ts +7 -6
- package/dist/internal/runtime/context/context-rules-frontmatter.d.ts +30 -0
- package/dist/internal/runtime/context/context-yaml-lite.d.ts +26 -0
- package/dist/project.cjs.map +1 -1
- package/dist/project.js.map +1 -1
- package/dist/{run-CLXKMRgq.d.cts → run-CrHz9BAP.d.cts} +9 -0
- package/dist/{run-CLXKMRgq.d.ts → run-CrHz9BAP.d.ts} +9 -0
- package/dist/types/run.d.ts +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bf66122: Add `.theokit/rules/*.md` — theokit-native path-scoped rule files, mirroring Claude Code's `.claude/rules/`.
|
|
8
|
+
|
|
9
|
+
Each rule file carries frontmatter with `paths:` (Claude Code parity) and/or `globs:` (Cursor-compatible alias) — both are glob-pattern arrays — plus `alwaysApply` and `enabled`. Rules with `alwaysApply: true` load into the agent's context every send; path-scoped rules activate only when an in-scope file matches, declared per-send via the new `SendOptions.contextPaths`. The same in-scope signal also unblocks conditional activation for `.cursor/rules/*.mdc` globs. No new dependency — glob matching and the YAML-subset parser are shared across both rule formats.
|
|
10
|
+
|
|
11
|
+
Also fixes the shared glob compiler so `dir/**/*.ext` correctly matches a top-level file directly under `dir/` (e.g. `src/**/*.ts` now matches `src/foo.ts`, not just `src/a/b/foo.ts`) — the semantics Cursor and Claude Code document. This improves `.cursor/rules/*.mdc` glob activation as well. `*` and `?` no longer cross a `/` separator.
|
|
12
|
+
|
|
13
|
+
## 3.1.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 5f0507c: Fix a leaked timeout timer in `MessageBus.request` (a2a). The request raced the handler against a `setTimeout`, but never cleared the timer when the handler won — a successful request left a live 30s timer that kept the Node event loop alive, so a process hung after the reply. The timer is now cleared in a `finally`.
|
|
18
|
+
|
|
3
19
|
## 3.1.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/dist/a2a/index.cjs
CHANGED
|
@@ -962,10 +962,10 @@ function buildToolPrompt(prompt) {
|
|
|
962
962
|
Respond by calling the \`output\` tool with the structured answer that matches the schema.`;
|
|
963
963
|
}
|
|
964
964
|
function setupStructuredOutput(schema, maxRetries) {
|
|
965
|
-
const
|
|
965
|
+
const z8 = requireZod();
|
|
966
966
|
const jsonSchema = toJsonSchema(schema, { unrepresentable: "any" });
|
|
967
967
|
return {
|
|
968
|
-
z:
|
|
968
|
+
z: z8,
|
|
969
969
|
jsonSchema,
|
|
970
970
|
maxRetries: maxRetries ?? 1,
|
|
971
971
|
initialUsage: { inputTokens: 0, outputTokens: 0 }
|
|
@@ -6041,7 +6041,7 @@ async function buildSystemPromptContext(inputs, userText, memoryFacts, manager =
|
|
|
6041
6041
|
memory: memoryFacts.map((fact) => ({ text: fact.text }))
|
|
6042
6042
|
};
|
|
6043
6043
|
}
|
|
6044
|
-
async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
|
|
6044
|
+
async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary, contextPaths) {
|
|
6045
6045
|
const resolved = await resolveSendSkills(inputs, userText, memoryFacts);
|
|
6046
6046
|
const baseCtx = await buildSystemPromptContext(inputs, userText, memoryFacts, resolved.manager);
|
|
6047
6047
|
const assemblyCtx = {
|
|
@@ -6054,19 +6054,21 @@ async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFa
|
|
|
6054
6054
|
assemblyCtx.activeMemorySummary = activeMemorySummary;
|
|
6055
6055
|
}
|
|
6056
6056
|
if (inputs.context !== void 0) {
|
|
6057
|
+
await inputs.context.applyScope(contextPaths);
|
|
6057
6058
|
const internal = inputs.context.internalAssemblySnapshot();
|
|
6058
6059
|
assemblyCtx.contextSnapshot = { sources: internal.sources };
|
|
6059
6060
|
if (internal.maxTokens !== void 0) assemblyCtx.contextMaxTokens = internal.maxTokens;
|
|
6060
6061
|
}
|
|
6061
6062
|
return assemblyCtx;
|
|
6062
6063
|
}
|
|
6063
|
-
async function assembleSystemPromptForSend(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
|
|
6064
|
+
async function assembleSystemPromptForSend(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary, contextPaths) {
|
|
6064
6065
|
const ctx = await buildAssemblyContext(
|
|
6065
6066
|
inputs,
|
|
6066
6067
|
userText,
|
|
6067
6068
|
baseSystemPrompt,
|
|
6068
6069
|
memoryFacts,
|
|
6069
|
-
activeMemorySummary
|
|
6070
|
+
activeMemorySummary,
|
|
6071
|
+
contextPaths
|
|
6070
6072
|
);
|
|
6071
6073
|
return inputs.systemPromptPipeline.assemble(ctx);
|
|
6072
6074
|
}
|
|
@@ -6773,6 +6775,14 @@ var init_context_discovery = __esm({
|
|
|
6773
6775
|
followImports: false,
|
|
6774
6776
|
priority: 40
|
|
6775
6777
|
},
|
|
6778
|
+
{
|
|
6779
|
+
id: "theokit-rules",
|
|
6780
|
+
pattern: ".theokit/rules/*.md",
|
|
6781
|
+
scope: "globbed",
|
|
6782
|
+
parser: "rules-frontmatter",
|
|
6783
|
+
followImports: false,
|
|
6784
|
+
priority: 45
|
|
6785
|
+
},
|
|
6776
6786
|
{
|
|
6777
6787
|
id: "theokit-context",
|
|
6778
6788
|
pattern: ".theokit/context/*.md",
|
|
@@ -6856,32 +6866,27 @@ var init_context_import_resolver = __esm({
|
|
|
6856
6866
|
MAX_HOPS = 5;
|
|
6857
6867
|
}
|
|
6858
6868
|
});
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
}
|
|
6864
|
-
const yamlBody = m[1] ?? "";
|
|
6865
|
-
const body = m[2] ?? "";
|
|
6866
|
-
try {
|
|
6867
|
-
const parsed = parseSimpleYaml2(yamlBody);
|
|
6868
|
-
const validated = McdFrontmatterSchema.safeParse(parsed);
|
|
6869
|
-
if (!validated.success) return void 0;
|
|
6870
|
-
return { frontmatter: validated.data, body };
|
|
6871
|
-
} catch {
|
|
6872
|
-
return void 0;
|
|
6873
|
-
}
|
|
6869
|
+
|
|
6870
|
+
// src/internal/runtime/context/context-glob.ts
|
|
6871
|
+
function globToRegex(glob) {
|
|
6872
|
+
const compiled = glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*\//g, "::GLOBSTAR_SLASH::").replace(/\*\*/g, "::GLOBSTAR::").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(/::GLOBSTAR_SLASH::/g, "(?:.*/)?").replace(/::GLOBSTAR::/g, ".*");
|
|
6873
|
+
return new RegExp(`^${compiled}$`);
|
|
6874
6874
|
}
|
|
6875
|
-
function
|
|
6876
|
-
if (
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
const globRes = fm.globs.map(globToRegex);
|
|
6880
|
-
return touchedFiles.some((file) => globRes.some((re) => re.test(file)));
|
|
6875
|
+
function anyGlobMatches(patterns, paths) {
|
|
6876
|
+
if (patterns.length === 0 || paths.length === 0) return false;
|
|
6877
|
+
const res = patterns.map(globToRegex);
|
|
6878
|
+
return paths.some((p) => res.some((re) => re.test(p)));
|
|
6881
6879
|
}
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6880
|
+
var init_context_glob = __esm({
|
|
6881
|
+
"src/internal/runtime/context/context-glob.ts"() {
|
|
6882
|
+
}
|
|
6883
|
+
});
|
|
6884
|
+
|
|
6885
|
+
// src/internal/runtime/context/context-yaml-lite.ts
|
|
6886
|
+
function splitFrontmatter3(content) {
|
|
6887
|
+
const m = FRONTMATTER_RE.exec(content);
|
|
6888
|
+
if (m === null) return { yaml: void 0, body: content };
|
|
6889
|
+
return { yaml: m[1] ?? "", body: m[2] ?? "" };
|
|
6885
6890
|
}
|
|
6886
6891
|
function parseSimpleYaml2(yaml) {
|
|
6887
6892
|
const out = {};
|
|
@@ -6928,15 +6933,76 @@ function parseScalar(s) {
|
|
|
6928
6933
|
if (/^-?\d+$/.test(s)) return parseInt(s, 10);
|
|
6929
6934
|
return s.replace(/^["']|["']$/g, "");
|
|
6930
6935
|
}
|
|
6931
|
-
var
|
|
6936
|
+
var FRONTMATTER_RE;
|
|
6937
|
+
var init_context_yaml_lite = __esm({
|
|
6938
|
+
"src/internal/runtime/context/context-yaml-lite.ts"() {
|
|
6939
|
+
FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
|
|
6940
|
+
}
|
|
6941
|
+
});
|
|
6942
|
+
function parseMdc(content) {
|
|
6943
|
+
const { yaml, body } = splitFrontmatter3(content);
|
|
6944
|
+
if (yaml === void 0) {
|
|
6945
|
+
return { frontmatter: { alwaysApply: true }, body: content };
|
|
6946
|
+
}
|
|
6947
|
+
try {
|
|
6948
|
+
const parsed = parseSimpleYaml2(yaml);
|
|
6949
|
+
const validated = McdFrontmatterSchema.safeParse(parsed);
|
|
6950
|
+
if (!validated.success) return void 0;
|
|
6951
|
+
return { frontmatter: validated.data, body };
|
|
6952
|
+
} catch {
|
|
6953
|
+
return void 0;
|
|
6954
|
+
}
|
|
6955
|
+
}
|
|
6956
|
+
function shouldActivate(fm, touchedFiles) {
|
|
6957
|
+
if (fm.alwaysApply === true) return true;
|
|
6958
|
+
if (fm.globs === void 0 || fm.globs.length === 0) return false;
|
|
6959
|
+
return anyGlobMatches(fm.globs, touchedFiles);
|
|
6960
|
+
}
|
|
6961
|
+
var McdFrontmatterSchema;
|
|
6932
6962
|
var init_context_mdc_parser = __esm({
|
|
6933
6963
|
"src/internal/runtime/context/context-mdc-parser.ts"() {
|
|
6964
|
+
init_context_glob();
|
|
6965
|
+
init_context_yaml_lite();
|
|
6934
6966
|
McdFrontmatterSchema = zod.z.object({
|
|
6935
6967
|
description: zod.z.string().optional(),
|
|
6936
6968
|
globs: zod.z.array(zod.z.string()).optional(),
|
|
6937
6969
|
alwaysApply: zod.z.boolean().optional()
|
|
6938
6970
|
});
|
|
6939
|
-
|
|
6971
|
+
}
|
|
6972
|
+
});
|
|
6973
|
+
function parseRules(content) {
|
|
6974
|
+
const { yaml, body } = splitFrontmatter3(content);
|
|
6975
|
+
if (yaml === void 0) {
|
|
6976
|
+
return { frontmatter: { alwaysApply: true }, body: content };
|
|
6977
|
+
}
|
|
6978
|
+
try {
|
|
6979
|
+
const parsed = parseSimpleYaml2(yaml);
|
|
6980
|
+
const validated = RulesFrontmatterSchema.safeParse(parsed);
|
|
6981
|
+
if (!validated.success) return void 0;
|
|
6982
|
+
return { frontmatter: validated.data, body };
|
|
6983
|
+
} catch {
|
|
6984
|
+
return void 0;
|
|
6985
|
+
}
|
|
6986
|
+
}
|
|
6987
|
+
function shouldActivateRule(fm, inScopePaths) {
|
|
6988
|
+
if (fm.enabled === false) return false;
|
|
6989
|
+
if (fm.alwaysApply === true) return true;
|
|
6990
|
+
const patterns = [...fm.paths ?? [], ...fm.globs ?? []];
|
|
6991
|
+
if (patterns.length === 0) return false;
|
|
6992
|
+
return anyGlobMatches(patterns, inScopePaths);
|
|
6993
|
+
}
|
|
6994
|
+
var RulesFrontmatterSchema;
|
|
6995
|
+
var init_context_rules_frontmatter = __esm({
|
|
6996
|
+
"src/internal/runtime/context/context-rules-frontmatter.ts"() {
|
|
6997
|
+
init_context_glob();
|
|
6998
|
+
init_context_yaml_lite();
|
|
6999
|
+
RulesFrontmatterSchema = zod.z.object({
|
|
7000
|
+
description: zod.z.string().optional(),
|
|
7001
|
+
paths: zod.z.array(zod.z.string()).optional(),
|
|
7002
|
+
globs: zod.z.array(zod.z.string()).optional(),
|
|
7003
|
+
alwaysApply: zod.z.boolean().optional(),
|
|
7004
|
+
enabled: zod.z.boolean().optional()
|
|
7005
|
+
});
|
|
6940
7006
|
}
|
|
6941
7007
|
});
|
|
6942
7008
|
async function runDiscovery(opts) {
|
|
@@ -6972,6 +7038,9 @@ async function loadOneSource(spec, path$1, opts, gitRoot) {
|
|
|
6972
7038
|
if (spec.parser === "mdc") {
|
|
6973
7039
|
return loadMdcSource(spec, path$1, id, opts);
|
|
6974
7040
|
}
|
|
7041
|
+
if (spec.parser === "rules-frontmatter") {
|
|
7042
|
+
return loadRulesSource(spec, path$1, id, opts);
|
|
7043
|
+
}
|
|
6975
7044
|
if (spec.parser === "frontmatter-zod") {
|
|
6976
7045
|
return void 0;
|
|
6977
7046
|
}
|
|
@@ -6995,6 +7064,24 @@ async function loadMdcSource(spec, path, id, opts) {
|
|
|
6995
7064
|
truncated: false
|
|
6996
7065
|
};
|
|
6997
7066
|
}
|
|
7067
|
+
async function loadRulesSource(spec, path, id, opts) {
|
|
7068
|
+
let raw;
|
|
7069
|
+
try {
|
|
7070
|
+
raw = await promises.readFile(path, "utf8");
|
|
7071
|
+
} catch {
|
|
7072
|
+
return void 0;
|
|
7073
|
+
}
|
|
7074
|
+
const parsed = parseRules(raw);
|
|
7075
|
+
if (parsed === void 0) return void 0;
|
|
7076
|
+
if (!shouldActivateRule(parsed.frontmatter, opts.touchedFiles ?? [])) return void 0;
|
|
7077
|
+
return {
|
|
7078
|
+
id,
|
|
7079
|
+
source: path,
|
|
7080
|
+
content: parsed.body,
|
|
7081
|
+
priority: spec.priority,
|
|
7082
|
+
truncated: false
|
|
7083
|
+
};
|
|
7084
|
+
}
|
|
6998
7085
|
async function loadPlainMarkdownSource(spec, path, id, opts) {
|
|
6999
7086
|
const loaded = await loadPlainMarkdown(path, { maxBytesPerFile: opts.maxBytesPerFile });
|
|
7000
7087
|
if (loaded === void 0) return void 0;
|
|
@@ -7020,6 +7107,7 @@ var init_context_discovery_runner = __esm({
|
|
|
7020
7107
|
init_context_import_resolver();
|
|
7021
7108
|
init_context_loaders();
|
|
7022
7109
|
init_context_mdc_parser();
|
|
7110
|
+
init_context_rules_frontmatter();
|
|
7023
7111
|
}
|
|
7024
7112
|
});
|
|
7025
7113
|
var ContextSourceFrontmatterSchema;
|
|
@@ -7155,6 +7243,10 @@ function matchesGlob(pattern, path) {
|
|
|
7155
7243
|
function tokenizeContent(content) {
|
|
7156
7244
|
return content.split(/\s+/).filter((token) => token.length > 0);
|
|
7157
7245
|
}
|
|
7246
|
+
function sameScope(a, b) {
|
|
7247
|
+
if (a.length !== b.length) return false;
|
|
7248
|
+
return a.every((v, i) => v === b[i]);
|
|
7249
|
+
}
|
|
7158
7250
|
var FileContextManager;
|
|
7159
7251
|
var init_context_manager = __esm({
|
|
7160
7252
|
"src/internal/runtime/context/context-manager.ts"() {
|
|
@@ -7175,6 +7267,13 @@ var init_context_manager = __esm({
|
|
|
7175
7267
|
settings;
|
|
7176
7268
|
settingSourcesIncludeProject;
|
|
7177
7269
|
state;
|
|
7270
|
+
/**
|
|
7271
|
+
* The in-scope file set used by the most recent `refresh`. Tracked so
|
|
7272
|
+
* `applyScope` only touches state when the scope actually changes — a
|
|
7273
|
+
* caller that never scopes (the common case) keeps the create-time
|
|
7274
|
+
* snapshot untouched, at zero per-send cost.
|
|
7275
|
+
*/
|
|
7276
|
+
lastScope = [];
|
|
7178
7277
|
async initialize() {
|
|
7179
7278
|
if (!this.settingSourcesIncludeProject && this.settings.manager !== "file") {
|
|
7180
7279
|
this.state = { config: { sources: [] }, loadedSources: [] };
|
|
@@ -7182,14 +7281,31 @@ var init_context_manager = __esm({
|
|
|
7182
7281
|
}
|
|
7183
7282
|
await this.refresh();
|
|
7184
7283
|
}
|
|
7185
|
-
|
|
7284
|
+
/**
|
|
7285
|
+
* Re-run discovery for a specific per-send in-scope file set (T3). Path-scoped
|
|
7286
|
+
* rules (`.theokit/rules/*.md`, `.cursor/rules/*.mdc` globs) activate iff a
|
|
7287
|
+
* pattern matches one of `contextPaths`. Idempotent: unchanged scope is a
|
|
7288
|
+
* no-op, and `undefined` scope while never previously scoped never touches
|
|
7289
|
+
* state (preserves the create-time snapshot for non-users).
|
|
7290
|
+
*/
|
|
7291
|
+
async applyScope(contextPaths) {
|
|
7292
|
+
const scope = contextPaths ?? [];
|
|
7293
|
+
if (scope.length === 0 && this.lastScope.length === 0) return;
|
|
7294
|
+
if (sameScope(scope, this.lastScope)) return;
|
|
7295
|
+
await this.refresh({ touchedFiles: scope });
|
|
7296
|
+
}
|
|
7297
|
+
async refresh(opts) {
|
|
7298
|
+
const touchedFiles = opts?.touchedFiles ?? [];
|
|
7299
|
+
this.lastScope = [...touchedFiles];
|
|
7186
7300
|
const config = await loadContextConfig(this.cwd);
|
|
7187
7301
|
const legacy = await loadSources(config, this.cwd);
|
|
7188
7302
|
const maxBytesPerFile = this.settings.maxBytesPerFile ?? DEFAULT_MAX_BYTES_PER_FILE;
|
|
7189
7303
|
const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
|
|
7190
7304
|
const discovered = await runDiscovery({
|
|
7191
7305
|
cwd: this.cwd,
|
|
7192
|
-
maxBytesPerFile
|
|
7306
|
+
maxBytesPerFile,
|
|
7307
|
+
touchedFiles
|
|
7308
|
+
});
|
|
7193
7309
|
const legacyAsAggregator = legacy.map((src) => ({
|
|
7194
7310
|
id: src.name,
|
|
7195
7311
|
source: src.path,
|
|
@@ -16966,7 +17082,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
16966
17082
|
userText,
|
|
16967
17083
|
baseSystemPrompt,
|
|
16968
17084
|
memoryFacts,
|
|
16969
|
-
activeMemorySummary
|
|
17085
|
+
activeMemorySummary,
|
|
17086
|
+
options.contextPaths
|
|
16970
17087
|
);
|
|
16971
17088
|
const projectedSystemPrompt = await projectCurrentObjective(
|
|
16972
17089
|
inputs.storageHandle,
|
|
@@ -17854,7 +17971,7 @@ var init_local_agent = __esm({
|
|
|
17854
17971
|
runPreHook: (ut) => this.runPreHook(ut),
|
|
17855
17972
|
// biome-ignore format: G8 budget — callbacks wire to private methods.
|
|
17856
17973
|
resolveSystemPromptForSend: (ut, o, mf) => this.resolveSystemPrompt(ut, o, mf),
|
|
17857
|
-
assembleSystemPromptForSend: (ut, bp, mf, ams) => assembleSystemPromptForSend(this.assemblyInputs(), ut, bp, mf, ams),
|
|
17974
|
+
assembleSystemPromptForSend: (ut, bp, mf, ams, cp) => assembleSystemPromptForSend(this.assemblyInputs(), ut, bp, mf, ams, cp),
|
|
17858
17975
|
dispatchRun: (msg, o, sp, mf, pm, mt, mp) => this.dispatchRun(msg, o, sp, mf, pm, mt, mp)
|
|
17859
17976
|
},
|
|
17860
17977
|
message,
|
|
@@ -19201,15 +19318,20 @@ var MessageBus = class {
|
|
|
19201
19318
|
// SE3 — provenance projection of the sender address (thin view over `from`).
|
|
19202
19319
|
origin: { kind: "peer", from }
|
|
19203
19320
|
};
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
(
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19321
|
+
let timer;
|
|
19322
|
+
try {
|
|
19323
|
+
return await Promise.race([
|
|
19324
|
+
Promise.resolve(handler(message)),
|
|
19325
|
+
new Promise((_, reject) => {
|
|
19326
|
+
timer = setTimeout(
|
|
19327
|
+
() => reject(new Error(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`)),
|
|
19328
|
+
timeoutMs
|
|
19329
|
+
);
|
|
19330
|
+
})
|
|
19331
|
+
]);
|
|
19332
|
+
} finally {
|
|
19333
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
19334
|
+
}
|
|
19213
19335
|
}
|
|
19214
19336
|
has(agentId) {
|
|
19215
19337
|
return this._handlers.has(agentId);
|