@opengeni/worker-bundle 0.29.0-canary.1 → 1.0.0-canary.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.
Files changed (47) hide show
  1. package/dist/activities/agent-turn/knowledge-source-tools.d.ts +9 -0
  2. package/dist/activities/agent-turn/knowledge-sources.d.ts +20 -0
  3. package/dist/activities/agent-turn/stream-attempt.d.ts +1 -0
  4. package/dist/activities/agent-turn/tool-environment.d.ts +1 -0
  5. package/dist/activities/knowledge-indexing.d.ts +10 -0
  6. package/dist/activities/run-input.d.ts +1 -0
  7. package/dist/activities/types.d.ts +10 -3
  8. package/dist/{activities-control-MKGEOBXT.js → activities-control-HMFGSKC5.js} +331 -3381
  9. package/dist/activities-control-HMFGSKC5.js.map +1 -0
  10. package/dist/activities-control.d.ts +12 -0
  11. package/dist/{activities-turn-MYD63DTN.js → activities-turn-AP67JADS.js} +1293 -1020
  12. package/dist/activities-turn-AP67JADS.js.map +1 -0
  13. package/dist/activities.d.ts +12 -0
  14. package/dist/{chunk-OA5CSY5N.js → chunk-CYITU5UH.js} +3348 -174
  15. package/dist/chunk-CYITU5UH.js.map +1 -0
  16. package/dist/index.d.ts +13 -0
  17. package/dist/index.js +48 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/workflow-bundle.js +65 -35
  20. package/dist/workflows/knowledge-indexing.d.ts +2 -0
  21. package/dist/workflows.d.ts +1 -0
  22. package/package.json +19 -18
  23. package/src/activities/agent-turn/knowledge-source-tools.ts +98 -0
  24. package/src/activities/agent-turn/knowledge-sources.ts +86 -0
  25. package/src/activities/agent-turn/run.ts +1244 -1112
  26. package/src/activities/agent-turn/skill-install.ts +1 -1
  27. package/src/activities/agent-turn/skill-save.ts +1 -1
  28. package/src/activities/agent-turn/skill-tools.ts +5 -12
  29. package/src/activities/agent-turn/stream-attempt.ts +3 -0
  30. package/src/activities/agent-turn/tool-environment.ts +24 -0
  31. package/src/activities/documents.ts +17 -52
  32. package/src/activities/knowledge-indexing.ts +130 -0
  33. package/src/activities/knowledge-source-sync.ts +120 -16
  34. package/src/activities/mcp-credentials.ts +2 -0
  35. package/src/activities/run-input.ts +2 -0
  36. package/src/activities/scheduled-tasks.ts +25 -62
  37. package/src/activities/types.ts +8 -2
  38. package/src/activities/video-generation-reconciliation.ts +8 -1
  39. package/src/activities-control.ts +2 -0
  40. package/src/activities.ts +1 -0
  41. package/src/index.ts +49 -0
  42. package/src/pr-review-credentials.ts +2 -2
  43. package/src/workflows/knowledge-indexing.ts +12 -0
  44. package/src/workflows.ts +1 -0
  45. package/dist/activities-control-MKGEOBXT.js.map +0 -1
  46. package/dist/activities-turn-MYD63DTN.js.map +0 -1
  47. package/dist/chunk-OA5CSY5N.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ import type { AttemptToolDefinition } from "@opengeni/codemode";
2
+ import { type Database, type KnowledgeContext } from "@opengeni/db";
3
+ import type { RunKnowledgeSourceSyncBatchInput, RunKnowledgeSourceSyncBatchResult } from "../types.js";
4
+ /** This tool exists only in an ordinary run with a frozen connector selection. */
5
+ export declare function createKnowledgeSourceAttemptTools(input: {
6
+ db: Database;
7
+ context: KnowledgeContext;
8
+ fetch: (input: RunKnowledgeSourceSyncBatchInput) => Promise<RunKnowledgeSourceSyncBatchResult>;
9
+ }): Promise<AttemptToolDefinition[]>;
@@ -0,0 +1,20 @@
1
+ import { type FirstPartyMcpToolName, type Permission, type ResourceRef, type KnowledgeFilePreparationResult } from "@opengeni/contracts";
2
+ import { type Settings } from "@opengeni/config";
3
+ import { createFirstPartyAttemptClient } from "@opengeni/runtime";
4
+ export type KnowledgeSourcePreparationOutcome = KnowledgeFilePreparationResult | {
5
+ status: "failed";
6
+ fileId: string;
7
+ message: string;
8
+ };
9
+ /** Accepted chat/schedule resources use ordinary agent authority and policy. */
10
+ export declare function prepareTurnKnowledgeSources(input: {
11
+ settings: Settings;
12
+ scope: Parameters<typeof createFirstPartyAttemptClient>[0]["scope"];
13
+ resources: readonly ResourceRef[];
14
+ selectedTools?: readonly FirstPartyMcpToolName[] | undefined;
15
+ permissions?: readonly Permission[] | null | undefined;
16
+ learningMode: "automatic" | "review_first" | "off";
17
+ signal?: AbortSignal | undefined;
18
+ onOutcome: (outcome: KnowledgeSourcePreparationOutcome) => Promise<void>;
19
+ prepare?: (fileId: string) => Promise<KnowledgeFilePreparationResult>;
20
+ }): Promise<string | undefined>;
@@ -74,6 +74,7 @@ export type TurnStreamAttemptDeps = {
74
74
  unavailableSandboxFilesNote: string | undefined;
75
75
  runCredentialsNote: string | undefined;
76
76
  mcpAvailabilityNote: string | undefined;
77
+ knowledgeSourcePreparationNote?: string | undefined;
77
78
  fileAuthoritySubjectId: string | null;
78
79
  activeSandboxBackend: Settings["sandboxBackend"] | undefined;
79
80
  groupBoxBackend: Settings["sandboxBackend"];
@@ -24,6 +24,7 @@ export type PrepareTurnToolPolicyDeps = {
24
24
  workspaceRefs: WorkspaceRefState;
25
25
  };
26
26
  export type PrepareTurnToolRuntimeDeps = {
27
+ fetchKnowledgeSource?: ((input: import("../types.js").RunKnowledgeSourceSyncBatchInput) => Promise<import("../types.js").RunKnowledgeSourceSyncBatchResult>) | undefined;
27
28
  selectedSkillActivations: readonly RuntimeSkillActivation[];
28
29
  input: RunAgentTurnInput;
29
30
  catalogSourceSettings: Settings;
@@ -0,0 +1,10 @@
1
+ import type { DocumentServices } from "@opengeni/documents";
2
+ import type { ControlActivityServices } from "./types.js";
3
+ export declare function createKnowledgeIndexingActivities(services: () => Promise<ControlActivityServices>, resolveDocumentServices?: () => Promise<DocumentServices>): {
4
+ indexKnowledge: () => Promise<{
5
+ completed: number;
6
+ advanced: number;
7
+ deferred: number;
8
+ unavailable: number;
9
+ }>;
10
+ };
@@ -32,6 +32,7 @@ export type TurnInputOptions = {
32
32
  unavailableSandboxFilesNote?: string;
33
33
  runCredentialsNote?: string;
34
34
  mcpAvailabilityNote?: string;
35
+ knowledgeSourcePreparationNote?: string;
35
36
  providerApi: HistoryProviderApi;
36
37
  projectCanonicalHistory?: ModelHistoryAttachmentProjector;
37
38
  materializeModelHistory?: ModelHistoryAttachmentProjector;
@@ -1,5 +1,5 @@
1
1
  import type { Settings } from "@opengeni/config";
2
- import type { ConnectionCredentialsPort, DocumentAuthorityKind, EntitlementsPort, ScheduledTaskTriggerType, TurnInitiator } from "@opengeni/contracts";
2
+ import type { ConnectionCredentialsPort, DocumentAuthorityKind, EntitlementsPort, KnowledgeSourceSyncRunSummary, ScheduledTaskTriggerType, TurnInitiator } from "@opengeni/contracts";
3
3
  import type { Database, SessionWorkflowWakeDeliveryResult } from "@opengeni/db";
4
4
  import type { DocumentServices } from "@opengeni/documents";
5
5
  import type { EventBus } from "@opengeni/events";
@@ -334,7 +334,7 @@ export type DispatchScheduledTaskRunResult = {
334
334
  action: "deleted";
335
335
  } | {
336
336
  action: "blocked";
337
- reason: "insufficient_credits" | "monthly_model_cost_limit" | "monthly_agent_run_limit" | "malformed_manual_trigger" | "scheduled_task_paused" | "scheduled_authority_exhausted" | "scheduled_run_terminal" | "scheduled_execution_unrepresentable" | "knowledge_source_paused" | "incident_preflight_metadata_missing" | "incident_responder_under_capable" | "incident_data_source_unsuitable";
337
+ reason: "insufficient_credits" | "monthly_model_cost_limit" | "monthly_agent_run_limit" | "malformed_manual_trigger" | "scheduled_task_paused" | "scheduled_authority_exhausted" | "scheduled_run_terminal" | "scheduled_execution_unrepresentable" | "knowledge_source_paused" | "legacy_source_schedule_requires_migration" | "incident_preflight_metadata_missing" | "incident_responder_under_capable" | "incident_data_source_unsuitable";
338
338
  } | {
339
339
  action: "start" | "signal";
340
340
  accountId: string;
@@ -353,6 +353,10 @@ export type DispatchScheduledTaskRunResult = {
353
353
  overlapPolicy: "skip" | "buffer_one";
354
354
  };
355
355
  export type RunKnowledgeSourceSyncBatchInput = {
356
+ /** Host-bound attempt only. Legacy control workflow inputs have none and cannot fetch. */
357
+ agent?: Extract<import("@opengeni/db").KnowledgeActor, {
358
+ kind: "agent";
359
+ }>;
356
360
  accountId: string;
357
361
  workspaceId: string;
358
362
  taskId: string;
@@ -380,7 +384,7 @@ export type DispatchAutomationRunResult = {
380
384
  } | {
381
385
  action: "not_found";
382
386
  };
383
- export type RunKnowledgeSourceSyncBatchResult = {
387
+ export type RunKnowledgeSourceSyncBatchResult = ({
384
388
  action: "continue";
385
389
  } | {
386
390
  action: "complete";
@@ -392,6 +396,9 @@ export type RunKnowledgeSourceSyncBatchResult = {
392
396
  action: "failed";
393
397
  bufferedWake: boolean;
394
398
  bufferedScheduledTaskRunId?: string | null;
399
+ }) & {
400
+ summary?: KnowledgeSourceSyncRunSummary;
401
+ errorCode?: string;
395
402
  };
396
403
  type DocumentIndexIdentity = {
397
404
  accountId: string;