@promptbook/cli 0.113.0-4 → 0.113.0-8
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/apps/agents-server/src/app/admin/update/AdvancedOriginRepositoryPanel.tsx +76 -0
- package/apps/agents-server/src/app/admin/update/CurrentDeploymentCard.tsx +160 -0
- package/apps/agents-server/src/app/admin/update/PendingCommitsCard.tsx +86 -0
- package/apps/agents-server/src/app/admin/update/TargetEnvironmentCard.tsx +331 -0
- package/apps/agents-server/src/app/admin/update/UpdateClient.tsx +20 -873
- package/apps/agents-server/src/app/admin/update/UpdateJobCard.tsx +329 -0
- package/apps/agents-server/src/app/admin/update/UpdateOverview.ts +74 -0
- package/apps/agents-server/src/app/admin/update/buildDeploymentTimeBehindLabel.ts +29 -0
- package/apps/agents-server/src/app/admin/update/formatHumanReadableTimestamp.ts +18 -0
- package/apps/agents-server/src/app/admin/update/getUpdateJobFailureMessage.ts +13 -0
- package/apps/agents-server/src/app/admin/update/getUpdateJobSuccessMessage.ts +13 -0
- package/apps/agents-server/src/app/admin/update/useUpdateClientState.ts +441 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +13 -1
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageClient.tsx +14 -559
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageHeader.tsx +84 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageSection.tsx +52 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/GeneratedCodePreview.tsx +138 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/GeneratedHarnessSection.tsx +98 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/SourceBookSection.tsx +66 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/TranspiledCodeErrorBanner.tsx +30 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/TranspiledCodeExportWarningBanner.tsx +62 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/Transpiler.ts +9 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/useAgentCodeExportState.ts +478 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/cloneMockedChatPreset.ts +17 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/confirmDeleteMockedChat.ts +16 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedMessage.ts +81 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedParticipant.ts +146 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedSettings.ts +19 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDuplicatedDraft.ts +66 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/findMockedChatById.ts +51 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/persistMockedChats.ts +51 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/useMockedChatsEditorState.ts +16 -426
- package/apps/agents-server/src/components/Homepage/buildFreeGraphBoxLayout.ts +446 -0
- package/apps/agents-server/src/components/Homepage/buildGraphLayoutNodes.ts +415 -157
- package/apps/agents-server/src/components/Homepage/useAgentsGraphCanvasState.ts +2 -1
- package/apps/agents-server/src/database/sqlite/$provideLocalSqliteSupabase.ts +3 -1541
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteQueryBuilder.ts +623 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteSupabaseClient.ts +64 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/ensureTable.ts +93 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteFilters.ts +202 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteMutationPayload.ts +131 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteRowOperations.ts +102 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteSql.ts +59 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.ts +329 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTypes.ts +84 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteValueCodec.ts +63 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/normalizeSqliteError.ts +22 -0
- package/apps/agents-server/src/search/createDefaultServerSearchProviders/loadLocalOrganizationSearchDataset.ts +12 -1
- package/apps/agents-server/src/tools/send_email.ts +1 -2
- package/apps/agents-server/src/utils/agentOrganization/loadAgentOrganizationState.ts +13 -1
- package/apps/agents-server/src/utils/backup/createServerBackupZipStream.ts +7 -1382
- package/apps/agents-server/src/utils/backup/serverBackup/appendAgentBackupEntriesToZip.ts +27 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendConversationBackupEntriesToZip.ts +140 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendFileBackupEntriesToZip.ts +147 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendMessageBackupEntriesToZip.ts +65 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendMetadataBackupEntriesToZip.ts +39 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendSectionEntriesToZip.ts +92 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendUserBackupEntriesToZip.ts +80 -0
- package/apps/agents-server/src/utils/backup/serverBackup/createRedactedWalletBackupRecord.ts +34 -0
- package/apps/agents-server/src/utils/backup/serverBackup/createServerBackupManifest.ts +82 -0
- package/apps/agents-server/src/utils/backup/serverBackup/downloadBackupBinaryContent.ts +39 -0
- package/apps/agents-server/src/utils/backup/serverBackup/resolveFeedbackThreadMessages.ts +53 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupAttachments.ts +151 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupContext.ts +167 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupFilenames.ts +161 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupPreviews.ts +97 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupRowUtilities.ts +158 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupTypes.ts +59 -0
- package/apps/agents-server/src/utils/createLocalAgentSourceImporter.ts +159 -0
- package/apps/agents-server/src/utils/createMissingImportedAgentFallback.ts +60 -0
- package/apps/agents-server/src/utils/customDomainRouting.ts +157 -12
- package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +1 -1
- package/apps/agents-server/src/utils/importAgentWithFallback.ts +1 -58
- package/apps/agents-server/src/utils/localAgentRouteReferences.ts +167 -0
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +1 -1
- package/apps/agents-server/src/utils/managementApi/managementApiAgents.ts +17 -3
- package/apps/agents-server/src/utils/messages/sendMessage.ts +5 -3
- package/apps/agents-server/src/utils/resolveAgentStateFromSource.ts +7 -1
- package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +54 -5
- package/apps/agents-server/src/utils/resolveServerAgentContext.ts +12 -1
- package/apps/agents-server/src/utils/resolveStoredAgentState.ts +2 -1
- package/apps/agents-server/src/utils/speech-to-text/SpeechToTextFailoverRecognition/SpeechToTextFailoverRecognitionProviderRuntime.ts +0 -1
- package/apps/agents-server/src/utils/speech-to-text/SpeechToTextFailoverRecognition.ts +34 -2
- package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +39 -9
- package/apps/agents-server/tests/e2e/support/ChatHistoryNavigationSupport.ts +5 -0
- package/esm/index.es.js +875 -60
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +7 -0
- package/esm/scripts/find-refactor-candidates/selectMostImportantRefactorCandidates.d.ts +12 -0
- package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +20 -0
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +29 -0
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +4 -0
- package/esm/src/avatars/renderAvatarVisualAsciiArt.d.ts +75 -0
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
- package/esm/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
- package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/avatars/avatarAnimationScheduler.ts +2 -1
- package/src/avatars/renderAvatarVisualAsciiArt.ts +138 -0
- package/src/avatars/visuals/octopus3d3AvatarVisual.ts +6 -2
- package/src/avatars/visuals/octopus3d4AvatarVisual.ts +14 -18
- package/src/book-components/Chat/Chat/insertDictationChunk.ts +3 -3
- package/src/book-components/Chat/Chat/learnDictationDictionary.ts +1 -1
- package/src/book-components/Chat/Chat/useChatInputAreaDictation.ts +133 -26
- package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +3 -1
- package/src/cli/cli-commands/coder/boilerplateTemplates.ts +14 -21
- package/src/cli/cli-commands/coder/find-refactor-candidates.ts +9 -2
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +1 -4
- package/src/cli/cli-commands/coder/run.ts +3 -27
- package/src/cli/cli-commands/common/createPositiveIntegerOptionParser.ts +31 -0
- package/src/commitments/TEAM/TEAM.ts +5 -5
- package/src/other/templates/getTemplatesPipelineCollection.ts +770 -1169
- package/src/utils/ascii-art/$detectTerminalAnsiColorDepth.ts +45 -0
- package/src/utils/ascii-art/convertImageDataToAsciiArt.ts +396 -0
- package/src/version.ts +2 -2
- package/src/versions.txt +2 -0
- package/umd/index.umd.js +875 -60
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +7 -0
- package/umd/scripts/find-refactor-candidates/selectMostImportantRefactorCandidates.d.ts +12 -0
- package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +20 -0
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +29 -0
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +4 -0
- package/umd/src/avatars/renderAvatarVisualAsciiArt.d.ts +75 -0
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
- package/umd/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
- package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
- package/umd/src/version.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +0 -6
- package/umd/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +0 -6
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AgentBasicInformation,
|
|
4
|
+
string_agent_permanent_id,
|
|
5
|
+
string_agent_url,
|
|
6
|
+
string_book,
|
|
7
|
+
} from '../../../../src/_packages/types.index';
|
|
8
|
+
import type { AgentReferenceResolver } from '../../../../src/book-2.0/agent-source/AgentReferenceResolver';
|
|
3
9
|
import type { AgentCollection } from '../../../../src/collection/agent-collection/AgentCollection';
|
|
10
|
+
import { DEFAULT_MAX_RECURSION } from '../../../../src/config';
|
|
11
|
+
import { NotFoundError } from '../../../../src/errors/NotFoundError';
|
|
12
|
+
import { ParseError } from '../../../../src/errors/ParseError';
|
|
13
|
+
import { spaceTrim } from '../../../../src/utils/organization/spaceTrim';
|
|
4
14
|
import { normalizeDomainForMatching } from '../../../../src/utils/validators/url/normalizeDomainForMatching';
|
|
5
15
|
import type { FederatedAgentImportConfiguration } from '../constants/federatedAgentImport';
|
|
6
16
|
import { createServerAgentReferenceResolver } from './agentReferenceResolver/createServerAgentReferenceResolver';
|
|
7
17
|
import { loadFederatedAgentImportConfiguration } from './federatedAgentImportConfiguration';
|
|
8
18
|
import { getFederatedServers } from './getFederatedServers';
|
|
9
19
|
import { getWellKnownAgentUrl } from './getWellKnownAgentUrl';
|
|
10
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
createLocalAgentUrl,
|
|
22
|
+
normalizeLocalAgentUrlReferences,
|
|
23
|
+
normalizeLocalServerUrls,
|
|
24
|
+
resolveLocalAgentRouteReference,
|
|
25
|
+
} from './localAgentRouteReferences';
|
|
26
|
+
import { createMissingImportedAgentFallback } from './createMissingImportedAgentFallback';
|
|
27
|
+
import { resolveInheritedAgentSource, type AgentSourceImporter } from './resolveInheritedAgentSource';
|
|
11
28
|
import { createServerPublicUrl, type ServerRecord } from './serverRegistry';
|
|
12
29
|
|
|
13
30
|
/**
|
|
@@ -111,11 +128,6 @@ type CustomDomainAgentRow = {
|
|
|
111
128
|
readonly agentSource: string;
|
|
112
129
|
};
|
|
113
130
|
|
|
114
|
-
/**
|
|
115
|
-
* Minimal agent identity row used to initialize compact-reference resolution.
|
|
116
|
-
*/
|
|
117
|
-
type CustomDomainAgentReferenceRow = Pick<CustomDomainAgentRow, 'agentName' | 'permanentId'>;
|
|
118
|
-
|
|
119
131
|
/**
|
|
120
132
|
* Minimal resolved metadata needed for custom-domain matching.
|
|
121
133
|
*/
|
|
@@ -127,7 +139,20 @@ type ResolvedCustomDomainMetadata = Pick<AgentBasicInformation, 'links' | 'meta'
|
|
|
127
139
|
* @param agents - Stored server-owned agents.
|
|
128
140
|
* @returns Lightweight collection compatible with the resolver initialization step.
|
|
129
141
|
*/
|
|
130
|
-
function createResolverAgentCollection(agents: ReadonlyArray<
|
|
142
|
+
function createResolverAgentCollection(agents: ReadonlyArray<CustomDomainAgentRow>): AgentCollection {
|
|
143
|
+
const resolveAgent = (agentNameOrPermanentId: string): CustomDomainAgentRow => {
|
|
144
|
+
const agent = agents.find(
|
|
145
|
+
(candidate) =>
|
|
146
|
+
candidate.agentName === agentNameOrPermanentId || candidate.permanentId === agentNameOrPermanentId,
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
if (!agent) {
|
|
150
|
+
throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return agent;
|
|
154
|
+
};
|
|
155
|
+
|
|
131
156
|
return {
|
|
132
157
|
async listAgents() {
|
|
133
158
|
return agents.map(
|
|
@@ -147,6 +172,13 @@ function createResolverAgentCollection(agents: ReadonlyArray<CustomDomainAgentRe
|
|
|
147
172
|
} satisfies AgentBasicInformation),
|
|
148
173
|
);
|
|
149
174
|
},
|
|
175
|
+
async getAgentPermanentId(agentNameOrPermanentId: string) {
|
|
176
|
+
const agent = resolveAgent(agentNameOrPermanentId);
|
|
177
|
+
return (agent.permanentId || agent.agentName) as string_agent_permanent_id;
|
|
178
|
+
},
|
|
179
|
+
async getAgentSource(agentNameOrPermanentId: string) {
|
|
180
|
+
return resolveAgent(agentNameOrPermanentId).agentSource as string_book;
|
|
181
|
+
},
|
|
150
182
|
} as unknown as AgentCollection;
|
|
151
183
|
}
|
|
152
184
|
|
|
@@ -181,6 +213,108 @@ function createCanonicalLocalAgentUrl(agent: CustomDomainAgentRow, localServerUr
|
|
|
181
213
|
return `${localServerUrl.replace(/\/+$/g, '')}/agents/${encodeURIComponent(canonicalAgentIdentifier)}`;
|
|
182
214
|
}
|
|
183
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Creates an Edge-safe local importer for custom-domain metadata resolution.
|
|
218
|
+
*
|
|
219
|
+
* @param options - Local collection and inheritance dependencies.
|
|
220
|
+
* @returns Local source importer for route-level agent URLs.
|
|
221
|
+
*/
|
|
222
|
+
function createCustomDomainLocalAgentSourceImporter(options: {
|
|
223
|
+
readonly collection: Pick<AgentCollection, 'getAgentPermanentId' | 'getAgentSource'>;
|
|
224
|
+
readonly localServerUrl: string;
|
|
225
|
+
readonly adamAgentUrl: string_agent_url;
|
|
226
|
+
readonly agentReferenceResolver: AgentReferenceResolver;
|
|
227
|
+
readonly federatedAgentImportConfiguration: FederatedAgentImportConfiguration;
|
|
228
|
+
}): AgentSourceImporter {
|
|
229
|
+
const localServerUrls = normalizeLocalServerUrls([options.localServerUrl]);
|
|
230
|
+
const localAgentUrlReferences = normalizeLocalAgentUrlReferences([options.adamAgentUrl]);
|
|
231
|
+
const agentSourceImporter: AgentSourceImporter = async (agentUrl, context) => {
|
|
232
|
+
const localRouteReference = resolveLocalAgentRouteReference(agentUrl, localServerUrls, localAgentUrlReferences);
|
|
233
|
+
|
|
234
|
+
if (!localRouteReference) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const nextRecursionLevel = (context.importAgentOptions.recursionLevel || 0) + 1;
|
|
239
|
+
assertCustomDomainLocalImportRecursionLevel(nextRecursionLevel, agentUrl);
|
|
240
|
+
|
|
241
|
+
let agentPermanentId: string_agent_permanent_id;
|
|
242
|
+
let unresolvedAgentSource: string_book;
|
|
243
|
+
|
|
244
|
+
try {
|
|
245
|
+
agentPermanentId = await options.collection.getAgentPermanentId(localRouteReference.agentIdentifier);
|
|
246
|
+
unresolvedAgentSource = await options.collection.getAgentSource(agentPermanentId);
|
|
247
|
+
} catch (error) {
|
|
248
|
+
if (error instanceof NotFoundError) {
|
|
249
|
+
return createMissingImportedAgentFallback(agentUrl, 1, error);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const resolvedAgentName = readAgentSourceTitle(unresolvedAgentSource) || localRouteReference.agentIdentifier;
|
|
256
|
+
const canonicalAgentUrl = createLocalAgentUrl(localRouteReference.localServerUrl, agentPermanentId);
|
|
257
|
+
|
|
258
|
+
return resolveInheritedAgentSource(unresolvedAgentSource, {
|
|
259
|
+
adamAgentUrl: options.adamAgentUrl,
|
|
260
|
+
recursionLevel: nextRecursionLevel,
|
|
261
|
+
inheritancePath: context.importAgentOptions.inheritancePath,
|
|
262
|
+
currentAgentUrl: canonicalAgentUrl,
|
|
263
|
+
currentAgentAliases: [
|
|
264
|
+
canonicalAgentUrl,
|
|
265
|
+
createLocalAgentUrl(localRouteReference.localServerUrl, localRouteReference.agentIdentifier),
|
|
266
|
+
createLocalAgentUrl(localRouteReference.localServerUrl, resolvedAgentName),
|
|
267
|
+
].filter((value, index, values): value is string_agent_url => values.indexOf(value) === index),
|
|
268
|
+
agentReferenceResolver: options.agentReferenceResolver,
|
|
269
|
+
federatedAgentImportConfiguration:
|
|
270
|
+
options.federatedAgentImportConfiguration || context.federatedAgentImportConfiguration,
|
|
271
|
+
agentSourceImporter,
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
return agentSourceImporter;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Reads the first non-empty title line from one book source.
|
|
280
|
+
*
|
|
281
|
+
* @param agentSource - Agent book source.
|
|
282
|
+
* @returns Title or `null` when the source has no title line.
|
|
283
|
+
*/
|
|
284
|
+
function readAgentSourceTitle(agentSource: string_book): string | null {
|
|
285
|
+
for (const line of agentSource.split(/\r?\n/)) {
|
|
286
|
+
const title = line.trim();
|
|
287
|
+
|
|
288
|
+
if (title) {
|
|
289
|
+
return title;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Throws when direct local importing would exceed the configured recursion limit.
|
|
298
|
+
*
|
|
299
|
+
* @param recursionLevel - Next recursion level.
|
|
300
|
+
* @param agentUrl - Local agent URL being imported.
|
|
301
|
+
*/
|
|
302
|
+
function assertCustomDomainLocalImportRecursionLevel(recursionLevel: number, agentUrl: string_agent_url): void {
|
|
303
|
+
if (recursionLevel <= DEFAULT_MAX_RECURSION) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
throw new ParseError(
|
|
308
|
+
spaceTrim(
|
|
309
|
+
(block) => `
|
|
310
|
+
Recursion depth ${recursionLevel} exceeds maximum allowed ${DEFAULT_MAX_RECURSION} while importing local custom-domain agent:
|
|
311
|
+
|
|
312
|
+
${block(agentUrl)}
|
|
313
|
+
`,
|
|
314
|
+
),
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
|
|
184
318
|
/**
|
|
185
319
|
* Parses only the resolved custom-domain metadata used by proxy routing.
|
|
186
320
|
*
|
|
@@ -254,6 +388,7 @@ async function resolveCustomDomainMetadataForAgent(
|
|
|
254
388
|
readonly adamAgentUrl: string;
|
|
255
389
|
readonly agentReferenceResolver: Awaited<ReturnType<typeof createServerAgentReferenceResolver>>;
|
|
256
390
|
readonly federatedAgentImportConfiguration: FederatedAgentImportConfiguration;
|
|
391
|
+
readonly agentSourceImporter: AgentSourceImporter;
|
|
257
392
|
},
|
|
258
393
|
): Promise<ResolvedCustomDomainMetadata> {
|
|
259
394
|
const resolvedAgentSource = await resolveInheritedAgentSource(agent.agentSource as string_book, {
|
|
@@ -261,6 +396,7 @@ async function resolveCustomDomainMetadataForAgent(
|
|
|
261
396
|
currentAgentUrl: createCanonicalLocalAgentUrl(agent, options.localServerUrl),
|
|
262
397
|
agentReferenceResolver: options.agentReferenceResolver,
|
|
263
398
|
federatedAgentImportConfiguration: options.federatedAgentImportConfiguration,
|
|
399
|
+
agentSourceImporter: options.agentSourceImporter,
|
|
264
400
|
});
|
|
265
401
|
|
|
266
402
|
return parseResolvedCustomDomainMetadata(resolvedAgentSource);
|
|
@@ -309,7 +445,7 @@ export async function resolveCustomDomainAgent(
|
|
|
309
445
|
|
|
310
446
|
const { data: resolverReferenceAgents, error: resolverReferenceError } = await supabase
|
|
311
447
|
.from(tableName)
|
|
312
|
-
.select('agentName, permanentId')
|
|
448
|
+
.select('agentName, permanentId, agentSource')
|
|
313
449
|
.is('deletedAt', null);
|
|
314
450
|
|
|
315
451
|
if (resolverReferenceError || !Array.isArray(resolverReferenceAgents)) {
|
|
@@ -317,13 +453,21 @@ export async function resolveCustomDomainAgent(
|
|
|
317
453
|
}
|
|
318
454
|
|
|
319
455
|
const localServerUrl = createServerPublicUrl(server.domain).href;
|
|
456
|
+
const agentCollection = createResolverAgentCollection(
|
|
457
|
+
resolverReferenceAgents as Array<CustomDomainAgentRow>,
|
|
458
|
+
);
|
|
320
459
|
const agentReferenceResolver = await createServerAgentReferenceResolver({
|
|
321
|
-
agentCollection
|
|
322
|
-
resolverReferenceAgents as Array<CustomDomainAgentReferenceRow>,
|
|
323
|
-
),
|
|
460
|
+
agentCollection,
|
|
324
461
|
localServerUrl,
|
|
325
462
|
federatedServers,
|
|
326
463
|
});
|
|
464
|
+
const agentSourceImporter = createCustomDomainLocalAgentSourceImporter({
|
|
465
|
+
collection: agentCollection,
|
|
466
|
+
localServerUrl,
|
|
467
|
+
adamAgentUrl,
|
|
468
|
+
agentReferenceResolver,
|
|
469
|
+
federatedAgentImportConfiguration,
|
|
470
|
+
});
|
|
327
471
|
|
|
328
472
|
let matchedAgent: CustomDomainAgentRow | undefined;
|
|
329
473
|
|
|
@@ -333,6 +477,7 @@ export async function resolveCustomDomainAgent(
|
|
|
333
477
|
adamAgentUrl,
|
|
334
478
|
agentReferenceResolver,
|
|
335
479
|
federatedAgentImportConfiguration,
|
|
480
|
+
agentSourceImporter,
|
|
336
481
|
});
|
|
337
482
|
|
|
338
483
|
if (matchesResolvedCustomDomain(resolvedMetadata, candidates)) {
|
|
@@ -153,7 +153,7 @@ async function enqueueExternalUserChatJob(job: UserChatJobRecord): Promise<Proce
|
|
|
153
153
|
return { didMutate: false, outcome: 'waiting' };
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
const threadMessages = createUserChatRunnerThreadMessages({
|
|
156
|
+
const threadMessages = await createUserChatRunnerThreadMessages({
|
|
157
157
|
messages: chat.messages,
|
|
158
158
|
userMessageId: job.userMessageId,
|
|
159
159
|
resolveInitialAgentMessage: () => parseAgentSource(agentSourceSnapshot.agentSource).initialMessage,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { padBook } from '../../../../src/book-2.0/agent-source/padBook';
|
|
2
|
-
import { validateBook } from '../../../../src/book-2.0/agent-source/string_book';
|
|
3
1
|
import type { string_agent_url } from '../../../../src/types/typeAliases';
|
|
4
2
|
import type { string_book } from '../../../../src/book-2.0/agent-source/string_book';
|
|
5
|
-
import { spaceTrim } from '../../../../src/utils/organization/spaceTrim';
|
|
6
3
|
import {
|
|
7
4
|
DEFAULT_FEDERATED_AGENT_IMPORT_CONFIGURATION,
|
|
8
5
|
type FederatedAgentImportConfiguration,
|
|
9
6
|
} from '../constants/federatedAgentImport';
|
|
7
|
+
import { createMissingImportedAgentFallback } from './createMissingImportedAgentFallback';
|
|
10
8
|
import { retryWithBackoff } from './retryWithBackoff';
|
|
11
9
|
import { importAgent, type ImportAgentOptions } from './importAgent';
|
|
12
10
|
|
|
@@ -40,61 +38,6 @@ const cachedFailedImportedAgentFallbackByKey = new Map<string, FailedImportedAge
|
|
|
40
38
|
*/
|
|
41
39
|
const pendingImportedAgentFallbackByKey = new Map<string, Promise<string_book>>();
|
|
42
40
|
|
|
43
|
-
/**
|
|
44
|
-
* Collapses one thrown error into a single-line message suitable for `NOTE` commitments.
|
|
45
|
-
*
|
|
46
|
-
* @param agentUrl - Canonical imported agent URL.
|
|
47
|
-
* @param error - Unknown error raised while loading the imported agent.
|
|
48
|
-
* @returns Human-readable single-line failure reason.
|
|
49
|
-
*
|
|
50
|
-
* @private internal helper for imported-agent fallback books
|
|
51
|
-
*/
|
|
52
|
-
function normalizeImportFailureMessage(agentUrl: string_agent_url, error: unknown): string {
|
|
53
|
-
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
54
|
-
const normalizedMessage = rawMessage.replace(/\s+/g, ' ').trim();
|
|
55
|
-
const prefix = `Failed to import agent from "${agentUrl}"`;
|
|
56
|
-
|
|
57
|
-
if (normalizedMessage.startsWith(prefix)) {
|
|
58
|
-
const suffix = normalizedMessage.slice(prefix.length).trim();
|
|
59
|
-
if (suffix.length > 0) {
|
|
60
|
-
return suffix.replace(/^[-:,\s]+/, '').trim() || 'unknown error';
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return normalizedMessage || 'unknown error';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Creates the ad-hoc fallback source returned when a federated imported agent stays unavailable.
|
|
69
|
-
*
|
|
70
|
-
* @param agentUrl - Canonical imported agent URL.
|
|
71
|
-
* @param attempts - Total number of attempts that were used.
|
|
72
|
-
* @param error - Final error raised by the failed import attempts.
|
|
73
|
-
* @returns Valid fallback book source.
|
|
74
|
-
*
|
|
75
|
-
* @private internal helper for imported-agent fallback books
|
|
76
|
-
*/
|
|
77
|
-
function createMissingImportedAgentFallback(
|
|
78
|
-
agentUrl: string_agent_url,
|
|
79
|
-
attempts: number,
|
|
80
|
-
error: unknown,
|
|
81
|
-
): string_book {
|
|
82
|
-
const failureMessage = normalizeImportFailureMessage(agentUrl, error);
|
|
83
|
-
|
|
84
|
-
return padBook(
|
|
85
|
-
validateBook(
|
|
86
|
-
spaceTrim(
|
|
87
|
-
`
|
|
88
|
-
Not found agent
|
|
89
|
-
|
|
90
|
-
NOTE This agent was supposed to be imported from ${agentUrl}, but it can not be loaded after ${attempts} attempts because of ${failureMessage}
|
|
91
|
-
CLOSED
|
|
92
|
-
`,
|
|
93
|
-
),
|
|
94
|
-
),
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
41
|
/**
|
|
99
42
|
* Builds the stable cache key used for import-with-fallback memoization.
|
|
100
43
|
*
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { string_agent_url } from '../../../../src/types/typeAliases';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parsed local agent route reference.
|
|
5
|
+
*/
|
|
6
|
+
export type LocalAgentRouteReference = {
|
|
7
|
+
/**
|
|
8
|
+
* Matched same-instance server origin.
|
|
9
|
+
*/
|
|
10
|
+
readonly localServerUrl: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Decoded route identifier after `/agents/`.
|
|
14
|
+
*/
|
|
15
|
+
readonly agentIdentifier: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Exact local route alias for one agent URL.
|
|
20
|
+
*/
|
|
21
|
+
export type LocalAgentUrlReference = LocalAgentRouteReference & {
|
|
22
|
+
/**
|
|
23
|
+
* Normalized exact local agent URL.
|
|
24
|
+
*/
|
|
25
|
+
readonly agentUrl: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Normalizes same-instance server URLs for route matching.
|
|
30
|
+
*
|
|
31
|
+
* @param localServerUrls - Raw server URLs.
|
|
32
|
+
* @returns Unique normalized origins without trailing slash.
|
|
33
|
+
*/
|
|
34
|
+
export function normalizeLocalServerUrls(localServerUrls: ReadonlyArray<string>): ReadonlyArray<string> {
|
|
35
|
+
return [
|
|
36
|
+
...new Set(
|
|
37
|
+
localServerUrls
|
|
38
|
+
.map((localServerUrl) => normalizeServerUrl(localServerUrl))
|
|
39
|
+
.filter((localServerUrl) => localServerUrl.length > 0),
|
|
40
|
+
),
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Normalizes exact local agent URL aliases for route matching.
|
|
46
|
+
*
|
|
47
|
+
* @param localAgentUrls - Raw local agent URLs.
|
|
48
|
+
* @returns Unique normalized route references.
|
|
49
|
+
*/
|
|
50
|
+
export function normalizeLocalAgentUrlReferences(
|
|
51
|
+
localAgentUrls: ReadonlyArray<string_agent_url>,
|
|
52
|
+
): ReadonlyArray<LocalAgentUrlReference> {
|
|
53
|
+
const localAgentUrlReferences: Array<LocalAgentUrlReference> = [];
|
|
54
|
+
const seenAgentUrls = new Set<string>();
|
|
55
|
+
|
|
56
|
+
for (const localAgentUrl of localAgentUrls) {
|
|
57
|
+
const localAgentRouteReference = parseLocalAgentRouteReference(localAgentUrl);
|
|
58
|
+
|
|
59
|
+
if (!localAgentRouteReference) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const normalizedAgentUrl = createLocalAgentUrl(
|
|
64
|
+
localAgentRouteReference.localServerUrl,
|
|
65
|
+
localAgentRouteReference.agentIdentifier,
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
if (seenAgentUrls.has(normalizedAgentUrl)) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
seenAgentUrls.add(normalizedAgentUrl);
|
|
73
|
+
localAgentUrlReferences.push({
|
|
74
|
+
...localAgentRouteReference,
|
|
75
|
+
agentUrl: normalizedAgentUrl,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return localAgentUrlReferences;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Extracts a local agent identifier from a same-instance agent URL.
|
|
84
|
+
*
|
|
85
|
+
* @param agentUrl - Referenced agent URL.
|
|
86
|
+
* @param localServerUrls - Normalized same-instance server origins.
|
|
87
|
+
* @param localAgentUrlReferences - Exact agent URL aliases that should resolve locally.
|
|
88
|
+
* @returns Route reference or `null` when the URL belongs to another server.
|
|
89
|
+
*/
|
|
90
|
+
export function resolveLocalAgentRouteReference(
|
|
91
|
+
agentUrl: string_agent_url,
|
|
92
|
+
localServerUrls: ReadonlyArray<string>,
|
|
93
|
+
localAgentUrlReferences: ReadonlyArray<LocalAgentUrlReference>,
|
|
94
|
+
): LocalAgentRouteReference | null {
|
|
95
|
+
const localAgentRouteReference = parseLocalAgentRouteReference(agentUrl);
|
|
96
|
+
|
|
97
|
+
if (!localAgentRouteReference) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (localServerUrls.includes(localAgentRouteReference.localServerUrl)) {
|
|
102
|
+
return localAgentRouteReference;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const normalizedAgentUrl = createLocalAgentUrl(
|
|
106
|
+
localAgentRouteReference.localServerUrl,
|
|
107
|
+
localAgentRouteReference.agentIdentifier,
|
|
108
|
+
);
|
|
109
|
+
return (
|
|
110
|
+
localAgentUrlReferences.find((localAgentUrlReference) => localAgentUrlReference.agentUrl === normalizedAgentUrl) ||
|
|
111
|
+
null
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Builds one local agent profile URL.
|
|
117
|
+
*
|
|
118
|
+
* @param localServerUrl - Same-instance server origin.
|
|
119
|
+
* @param agentIdentifier - Route agent identifier.
|
|
120
|
+
* @returns Local agent URL.
|
|
121
|
+
*/
|
|
122
|
+
export function createLocalAgentUrl(localServerUrl: string, agentIdentifier: string): string_agent_url {
|
|
123
|
+
return `${localServerUrl.replace(/\/+$/g, '')}/agents/${encodeURIComponent(agentIdentifier)}` as string_agent_url;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Normalizes one server URL to its origin.
|
|
128
|
+
*
|
|
129
|
+
* @param serverUrl - Raw server URL.
|
|
130
|
+
* @returns Normalized origin or an empty string when invalid.
|
|
131
|
+
*/
|
|
132
|
+
function normalizeServerUrl(serverUrl: string): string {
|
|
133
|
+
try {
|
|
134
|
+
return new URL(serverUrl).origin.replace(/\/+$/g, '');
|
|
135
|
+
} catch {
|
|
136
|
+
return serverUrl.replace(/\/+$/g, '');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Extracts a local route reference from an agent profile URL.
|
|
142
|
+
*
|
|
143
|
+
* @param agentUrl - Referenced agent URL.
|
|
144
|
+
* @returns Route reference or `null` when the URL is not an agent profile route.
|
|
145
|
+
*/
|
|
146
|
+
function parseLocalAgentRouteReference(agentUrl: string_agent_url): LocalAgentRouteReference | null {
|
|
147
|
+
let parsedAgentUrl: URL;
|
|
148
|
+
|
|
149
|
+
try {
|
|
150
|
+
parsedAgentUrl = new URL(agentUrl);
|
|
151
|
+
} catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const localServerUrl = normalizeServerUrl(parsedAgentUrl.origin);
|
|
156
|
+
const pathSegments = parsedAgentUrl.pathname.split('/').filter(Boolean);
|
|
157
|
+
const agentIdentifier = pathSegments[0] === 'agents' ? pathSegments[1] : null;
|
|
158
|
+
|
|
159
|
+
if (!agentIdentifier) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
localServerUrl,
|
|
165
|
+
agentIdentifier: decodeURIComponent(agentIdentifier),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -144,7 +144,7 @@ async function enqueueLocalUserChatJob(job: UserChatJobRecord): Promise<ProcessL
|
|
|
144
144
|
throw new Error(`User message "${job.userMessageId}" was not found in chat "${job.chatId}".`);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
const threadMessages = createUserChatRunnerThreadMessages({
|
|
147
|
+
const threadMessages = await createUserChatRunnerThreadMessages({
|
|
148
148
|
messages: chat.messages,
|
|
149
149
|
userMessageId: job.userMessageId,
|
|
150
150
|
resolveInitialAgentMessage: () => parseAgentSource(agentSourceSnapshot.agentSource).initialMessage,
|
|
@@ -4,8 +4,10 @@ import { loadLocalOrganizationSearchDataset } from '../../search/createDefaultSe
|
|
|
4
4
|
import { stringifyJsonForSearch } from '../../search/createDefaultServerSearchProviders/stringifyJsonForSearch';
|
|
5
5
|
import { $getTableName } from '../../database/$getTableName';
|
|
6
6
|
import { $provideSupabaseForServer } from '../../database/$provideSupabaseForServer';
|
|
7
|
+
import { $provideAgentCollectionForServer } from '../../tools/$provideAgentCollectionForServer';
|
|
7
8
|
import type { OwnedAgentRow } from '../agentOwnership';
|
|
8
9
|
import { $provideAgentReferenceResolver } from '../agentReferenceResolver/$provideAgentReferenceResolver';
|
|
10
|
+
import { createLocalAgentSourceImporter } from '../createLocalAgentSourceImporter';
|
|
9
11
|
import { getWellKnownAgentUrl } from '../getWellKnownAgentUrl';
|
|
10
12
|
import { resolveCurrentOrInternalServerOrigin } from '../resolveCurrentOrInternalServerOrigin';
|
|
11
13
|
import { resolveStoredAgentState } from '../resolveStoredAgentState';
|
|
@@ -42,10 +44,22 @@ export type ManagementAgentListItem = {
|
|
|
42
44
|
* @returns Resolved agent state derived from the stored unresolved source.
|
|
43
45
|
*/
|
|
44
46
|
export async function resolveOwnedAgentDerivedState(row: OwnedAgentRow) {
|
|
47
|
+
const localServerUrl = await resolveCurrentOrInternalServerOrigin();
|
|
48
|
+
const adamAgentUrl = await getWellKnownAgentUrl('ADAM');
|
|
49
|
+
const agentReferenceResolver = await $provideAgentReferenceResolver();
|
|
50
|
+
const agentSourceImporter = createLocalAgentSourceImporter({
|
|
51
|
+
collection: await $provideAgentCollectionForServer(),
|
|
52
|
+
localServerUrls: [localServerUrl],
|
|
53
|
+
localAgentUrls: [adamAgentUrl],
|
|
54
|
+
adamAgentUrl,
|
|
55
|
+
fallbackResolver: agentReferenceResolver,
|
|
56
|
+
});
|
|
57
|
+
|
|
45
58
|
return resolveStoredAgentState(row, {
|
|
46
|
-
localServerUrl
|
|
47
|
-
adamAgentUrl
|
|
48
|
-
agentReferenceResolver
|
|
59
|
+
localServerUrl,
|
|
60
|
+
adamAgentUrl,
|
|
61
|
+
agentReferenceResolver,
|
|
62
|
+
agentSourceImporter,
|
|
49
63
|
});
|
|
50
64
|
}
|
|
51
65
|
|
|
@@ -3,6 +3,7 @@ import { EMAIL_PROVIDERS } from '../../message-providers';
|
|
|
3
3
|
import type { MessageProvider } from '../../message-providers/interfaces/MessageProvider';
|
|
4
4
|
import type { OutboundEmail } from '../../message-providers/email/_common/Email';
|
|
5
5
|
import { createMessage } from './createMessage';
|
|
6
|
+
import { humanizeOutboundEmail } from './humanizeOutboundEmail';
|
|
6
7
|
import { sendMessageAttempt } from './sendMessageAttempt';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -63,14 +64,15 @@ export function isSendMessageDeliveryError(error: unknown): error is SendMessage
|
|
|
63
64
|
* Persists a message and, for outbound emails, creates send attempts until one provider succeeds.
|
|
64
65
|
*/
|
|
65
66
|
export async function sendMessage(message: OutboundEmail, options?: SendMessageOptions): Promise<SendMessageResult> {
|
|
66
|
-
const
|
|
67
|
+
const email = humanizeOutboundEmail(message);
|
|
68
|
+
const insertedMessage = await createMessage(email);
|
|
67
69
|
const baseResult: SendMessageResult = {
|
|
68
70
|
messageId: insertedMessage.id,
|
|
69
71
|
status: 'stored-only',
|
|
70
72
|
attempts: [],
|
|
71
73
|
};
|
|
72
74
|
|
|
73
|
-
if (
|
|
75
|
+
if (email.direction !== 'OUTBOUND' || email.channel !== 'EMAIL') {
|
|
74
76
|
return baseResult;
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -88,7 +90,7 @@ export async function sendMessage(message: OutboundEmail, options?: SendMessageO
|
|
|
88
90
|
messageId: insertedMessage.id,
|
|
89
91
|
providerName,
|
|
90
92
|
provider,
|
|
91
|
-
message,
|
|
93
|
+
message: email,
|
|
92
94
|
});
|
|
93
95
|
|
|
94
96
|
baseResult.attempts.push(attempt);
|
|
@@ -3,7 +3,7 @@ import type { AgentReferenceResolver } from '../../../../src/book-2.0/agent-sour
|
|
|
3
3
|
import type { FederatedAgentImportConfiguration } from '../constants/federatedAgentImport';
|
|
4
4
|
import { parseAgentSource } from '../../../../src/book-2.0/agent-source/parseAgentSource';
|
|
5
5
|
import { resolveTeamCapabilitiesFromAgentSource } from './agentReferenceResolver/resolveTeamCapabilitiesFromAgentSource';
|
|
6
|
-
import { resolveInheritedAgentSource } from './resolveInheritedAgentSource';
|
|
6
|
+
import { resolveInheritedAgentSource, type AgentSourceImporter } from './resolveInheritedAgentSource';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Options for deriving the canonical resolved agent state from an editable source.
|
|
@@ -33,6 +33,11 @@ export type ResolveAgentStateFromSourceOptions = {
|
|
|
33
33
|
* Retry configuration used when loading imported agents from federated servers.
|
|
34
34
|
*/
|
|
35
35
|
readonly federatedAgentImportConfiguration?: FederatedAgentImportConfiguration;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Optional importer for same-instance agent sources.
|
|
39
|
+
*/
|
|
40
|
+
readonly agentSourceImporter?: AgentSourceImporter;
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
/**
|
|
@@ -112,6 +117,7 @@ export async function resolveAgentStateFromSource(
|
|
|
112
117
|
currentAgentAliases: options.currentAgentAliases,
|
|
113
118
|
agentReferenceResolver: options.agentReferenceResolver,
|
|
114
119
|
federatedAgentImportConfiguration: options.federatedAgentImportConfiguration,
|
|
120
|
+
agentSourceImporter: options.agentSourceImporter,
|
|
115
121
|
});
|
|
116
122
|
const resolvedAgentProfile = parseAgentSource(resolvedAgentSource);
|
|
117
123
|
const resolvedTeamCapabilities = await resolveTeamCapabilitiesFromAgentSource(
|