@autopilot-agent/core 0.3.0 → 0.4.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 (44) hide show
  1. package/README.md +6 -2
  2. package/dist/experimental/index.js +147 -52
  3. package/dist/experimental/index.mjs +147 -52
  4. package/dist/index.d.ts +7 -2
  5. package/dist/index.js +278 -173
  6. package/dist/index.mjs +279 -174
  7. package/dist/internal/agent-runtime.d.ts +8 -0
  8. package/dist/internal/kernel/run-context.d.ts +2 -0
  9. package/dist/internal/kernel/turn-usage.d.ts +1 -0
  10. package/dist/internal/lib/llm.d.ts +1 -0
  11. package/dist/internal/lib/llm.js +1 -1
  12. package/dist/internal/tools/builtins/browser-tool.d.ts +13 -0
  13. package/dist/internal/tools/builtins/static-preview.d.ts +1 -1
  14. package/dist/internal/tools/builtins/thread-tools.d.ts +1 -1
  15. package/dist/internal/tools/permissions/command-policy.d.ts +2 -0
  16. package/dist/internal/tools/policy-engine.d.ts +1 -0
  17. package/dist/internal/tools/types.d.ts +3 -0
  18. package/dist/internal/types/agent-message.d.ts +1 -1
  19. package/dist/internal/types/index.d.ts +1 -1
  20. package/dist/runtime/application/runtime-facts.d.ts +54 -0
  21. package/dist/runtime/application/session-service.d.ts +1 -0
  22. package/dist/runtime/application/turn/turn-capability-ceiling.d.ts +2 -0
  23. package/dist/runtime/application/turn/turn-recovery-service.d.ts +2 -0
  24. package/dist/runtime/bootstrap/runtime-bootstrap-service.d.ts +2 -0
  25. package/dist/runtime/domain/frozen-run-config.d.ts +1 -0
  26. package/dist/runtime/domain/index.d.ts +9 -0
  27. package/dist/runtime/domain/model-ref.d.ts +1 -1
  28. package/dist/runtime/domain/turn.d.ts +8 -0
  29. package/dist/runtime/protocol/browser-capability.d.ts +81 -0
  30. package/dist/runtime/protocol/browser-operation.d.ts +89 -0
  31. package/dist/runtime/protocol/frozen-run-config-view.d.ts +2 -1
  32. package/dist/runtime/protocol/index.d.ts +2 -1
  33. package/dist/runtime/protocol/run-config.d.ts +12 -0
  34. package/dist/runtime/protocol/web-capability.d.ts +5 -1
  35. package/dist/runtime/provider/api-protocol.d.ts +16 -2
  36. package/dist/runtime/provider/compatibility-presets.d.ts +19 -0
  37. package/dist/runtime/provider/frozen-provider-config.d.ts +3 -1
  38. package/dist/runtime/provider/index.d.ts +3 -1
  39. package/dist/runtime/provider/model-capability-catalog.d.ts +5 -0
  40. package/dist/runtime/provider/model-sample-resolver.d.ts +3 -2
  41. package/dist/runtime/provider/openai-chat-completions-adapter.d.ts +3 -0
  42. package/dist/runtime/provider/openai-responses-adapter.d.ts +22 -0
  43. package/dist/runtime/public/agent-runtime.d.ts +1 -0
  44. package/package.json +1 -3
@@ -1,5 +1,17 @@
1
1
  import type { CredentialRef } from "../domain";
2
- export type ApiProtocol = "anthropic-messages" | "openai-chat-completions";
2
+ export type ApiProtocol = "anthropic-messages" | "openai-chat-completions" | "openai-responses";
3
+ export type CompatibilityPreset = "openai" | "deepseek" | "generic";
4
+ export interface OpenAiResponsesProtocolProfile {
5
+ apiProtocol: "openai-responses";
6
+ reasoningReplay: "none" | "encrypted" | "content";
7
+ }
8
+ export interface ModelCapabilityDeclaration {
9
+ supportedReasoningEfforts?: readonly import("../domain/model-ref").ReasoningEffort[];
10
+ defaultReasoningEffort?: import("../domain/model-ref").ReasoningEffort;
11
+ inputModalities?: readonly ("text" | "image")[];
12
+ supportsToolCalls?: boolean;
13
+ maxOutputTokens?: number;
14
+ }
3
15
  export interface AnthropicMessagesProtocolProfile {
4
16
  apiProtocol: "anthropic-messages";
5
17
  }
@@ -9,7 +21,7 @@ export interface OpenAiChatCompletionsProtocolProfile {
9
21
  supportsReasoningContent: boolean;
10
22
  supportsUsageInStreaming: boolean;
11
23
  }
12
- export type ProtocolProfile = AnthropicMessagesProtocolProfile | OpenAiChatCompletionsProtocolProfile;
24
+ export type ProtocolProfile = AnthropicMessagesProtocolProfile | OpenAiChatCompletionsProtocolProfile | OpenAiResponsesProtocolProfile;
13
25
  export interface ProviderRouteProfile {
14
26
  id: string;
15
27
  displayName?: string;
@@ -17,10 +29,12 @@ export interface ProviderRouteProfile {
17
29
  baseUrl: string;
18
30
  credentialRef: CredentialRef;
19
31
  protocolProfile?: ProtocolProfile;
32
+ compatibilityPreset?: CompatibilityPreset;
20
33
  models: ReadonlyArray<{
21
34
  id: string;
22
35
  protocolProfile?: ProtocolProfile;
23
36
  contextWindowTokens?: number;
37
+ capabilities?: ModelCapabilityDeclaration;
24
38
  }>;
25
39
  }
26
40
  export declare function isApiProtocol(value: unknown): value is ApiProtocol;
@@ -0,0 +1,19 @@
1
+ import type { CompatibilityPreset, OpenAiResponsesProtocolProfile } from "./api-protocol";
2
+ import type { ReasoningEffort } from "../domain/model-ref";
3
+ interface CompatibilityPresetPolicy {
4
+ responses: {
5
+ defaultProfile: OpenAiResponsesProtocolProfile;
6
+ requiresMatchingReplay: boolean;
7
+ supportedReasoningEfforts?: readonly ReasoningEffort[];
8
+ samplingWithoutReasoning: boolean;
9
+ };
10
+ chat: {
11
+ maxTokensField: "max_tokens" | "max_completion_tokens";
12
+ sampling: "default" | "none-only" | "omit";
13
+ supportsThinking: boolean;
14
+ supportsLegacyTopP: boolean;
15
+ };
16
+ }
17
+ export declare function isCompatibilityPreset(value: unknown): value is CompatibilityPreset;
18
+ export declare function getCompatibilityPresetPolicy(preset?: CompatibilityPreset): CompatibilityPresetPolicy;
19
+ export {};
@@ -13,16 +13,18 @@ export interface FrozenProviderConfig {
13
13
  provider: string;
14
14
  apiProtocol?: ApiProtocol;
15
15
  protocolProfile?: ProtocolProfile;
16
+ compatibilityPreset?: import("./api-protocol").CompatibilityPreset;
16
17
  baseUrl?: string;
17
18
  credentialRef?: CredentialRef;
18
19
  sampleOptions?: ModelSampleOptions;
19
20
  contextWindowTokens?: number;
21
+ maxOutputTokens?: number;
20
22
  supportsImageInput?: boolean;
21
23
  compactThresholdTokens?: number;
22
24
  timeoutMs?: number;
23
25
  subagentModelId?: string;
24
26
  effectiveReasoning?: {
25
- effort: "none" | "low" | "medium" | "high" | "max";
27
+ effort: "none" | "low" | "medium" | "high" | "xhigh" | "max";
26
28
  source: FirstPartyEffortSource;
27
29
  };
28
30
  vision?: FrozenVisionConfig;
@@ -9,7 +9,7 @@ export { ProviderProtocolAdapterRegistry } from "./provider-protocol-adapter";
9
9
  export { createFirstPartyModelSampler } from "./first-party-model-sampler";
10
10
  export type { CreateFirstPartyModelSamplerInput } from "./first-party-model-sampler";
11
11
  export { resolveFirstPartyModelSampleOptions, resolveModelSampleOptions } from "./model-sample-resolver";
12
- export { listModelCapabilities, getModelCapability } from "./model-capability-catalog";
12
+ export { listModelCapabilities, getModelCapability, resolveRouteModelCapability, resolveRouteProtocolProfile } from "./model-capability-catalog";
13
13
  export { createVisionAnalyzer } from "./vision-analyzer";
14
14
  export type { FrozenProviderConfig } from "./frozen-provider-config";
15
15
  export type { ModelCapability, PromptCacheMode } from "./model-capability-catalog";
@@ -17,3 +17,5 @@ export type { VisionAnalyzer } from "./vision-analyzer";
17
17
  export type { FirstPartyEffortSource, ResolvedFirstPartyModelSample } from "./model-sample-resolver";
18
18
  export { createDefaultModelBehaviorProfile } from "./model-behavior-profile";
19
19
  export type { ModelBehaviorProfile } from "./model-behavior-profile";
20
+ export { createOpenAiResponsesRequest, createOpenAiResponsesSampler } from "./openai-responses-adapter";
21
+ export type { CreateOpenAiResponsesSamplerInput } from "./openai-responses-adapter";
@@ -1,4 +1,5 @@
1
1
  import type { ModelRef, ReasoningEffort } from "../domain/model-ref";
2
+ import type { ModelCapabilityDeclaration, ProviderRouteProfile, ProtocolProfile } from "./api-protocol";
2
3
  export type PromptCacheMode = "server-auto" | "explicit" | "none";
3
4
  export interface ModelCapability {
4
5
  provider: "deepseek" | "ali";
@@ -13,3 +14,7 @@ export interface ModelCapability {
13
14
  export declare function listModelCapabilities(): readonly ModelCapability[];
14
15
  export declare function getModelCapability(provider: string, modelId: string): ModelCapability | undefined;
15
16
  export declare function getModelCapabilityForRef(modelRef: ModelRef): ModelCapability | undefined;
17
+ export declare function resolveRouteModelCapability(route: ProviderRouteProfile, modelId: string): ModelCapabilityDeclaration & {
18
+ contextWindowTokens?: number;
19
+ };
20
+ export declare function resolveRouteProtocolProfile(route: ProviderRouteProfile, modelId: string): ProtocolProfile | undefined;
@@ -2,14 +2,15 @@ import type { ModelRef } from "../domain/model-ref";
2
2
  import type { ReasoningProfile } from "../domain/reasoning-profile";
3
3
  import type { ModelSampleOptions } from "../../internal/types";
4
4
  export declare function resolveModelSampleOptions(ref?: ModelRef, profile?: ReasoningProfile): ModelSampleOptions;
5
- export type FirstPartyEffortSource = "requested";
5
+ export type FirstPartyEffortSource = "requested" | "default";
6
6
  export interface ResolvedFirstPartyModelSample {
7
7
  sampleOptions: ModelSampleOptions;
8
8
  effectiveReasoning?: {
9
- effort: "none" | "low" | "medium" | "high" | "max";
9
+ effort: "none" | "low" | "medium" | "high" | "xhigh" | "max";
10
10
  source: FirstPartyEffortSource;
11
11
  };
12
12
  }
13
13
  export declare function resolveFirstPartyModelSampleOptions(ref: ModelRef, profile?: ReasoningProfile, options?: {
14
14
  thinkingEnabled?: boolean;
15
15
  }): ResolvedFirstPartyModelSample;
16
+ export declare function resolveRouteModelSample(route: import("./api-protocol").ProviderRouteProfile, ref: ModelRef, profile?: ReasoningProfile): ResolvedFirstPartyModelSample;
@@ -8,9 +8,11 @@ export interface CreateOpenAiChatCompletionsSamplerInput {
8
8
  baseUrl?: string;
9
9
  apiKey?: string;
10
10
  timeoutMs?: number;
11
+ maxOutputTokens?: number;
11
12
  sampleOptions: ModelSampleOptions;
12
13
  protocolProfile?: OpenAiChatCompletionsProtocolProfile;
13
14
  behaviorProfile?: ModelBehaviorProfile;
15
+ compatibilityPreset?: import("./api-protocol").CompatibilityPreset;
14
16
  }
15
17
  export interface OpenAiChatCompletionsRequestInput {
16
18
  model: string;
@@ -18,6 +20,7 @@ export interface OpenAiChatCompletionsRequestInput {
18
20
  tools: AgentModelToolDefinition[];
19
21
  sampleOptions: ModelSampleOptions;
20
22
  maxTokens: number;
23
+ compatibilityPreset?: import("./api-protocol").CompatibilityPreset;
21
24
  protocolProfile: OpenAiChatCompletionsProtocolProfile;
22
25
  imageData?: import("../../internal/kernel/model-sampler").ModelImageData;
23
26
  }
@@ -0,0 +1,22 @@
1
+ import { type AgentModelToolDefinition } from "../../internal/lib/llm";
2
+ import type { ModelSampler, ModelImageData } from "../../internal/kernel/model-sampler";
3
+ import type { ModelSampleOptions } from "../../internal/types";
4
+ import { type AgentMessage } from "../../internal/types/agent-message";
5
+ import type { CompatibilityPreset, OpenAiResponsesProtocolProfile } from "./api-protocol";
6
+ export interface CreateOpenAiResponsesSamplerInput {
7
+ routeId: string;
8
+ baseUrl?: string;
9
+ apiKey?: string;
10
+ timeoutMs?: number;
11
+ maxOutputTokens?: number;
12
+ sampleOptions: ModelSampleOptions;
13
+ protocolProfile?: OpenAiResponsesProtocolProfile;
14
+ compatibilityPreset?: CompatibilityPreset;
15
+ }
16
+ export declare function createOpenAiResponsesRequest(input: CreateOpenAiResponsesSamplerInput & {
17
+ messages: AgentMessage[];
18
+ tools: AgentModelToolDefinition[];
19
+ options?: ModelSampleOptions;
20
+ imageData?: ModelImageData;
21
+ }): Record<string, unknown>;
22
+ export declare function createOpenAiResponsesSampler(input: CreateOpenAiResponsesSamplerInput): ModelSampler;
@@ -8,6 +8,7 @@ import type { JobService } from "../application/job-service";
8
8
  import type { UndoService } from "../application/undo-service";
9
9
  import type { UserQuestionSubmissionService } from "../application/user-question-service";
10
10
  export interface AgentRuntime {
11
+ facts: import("../application/runtime-facts").RuntimeFacts;
11
12
  threads: {
12
13
  bind(context: ThreadHostContext): ThreadFacade;
13
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autopilot-agent/core",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -73,11 +73,9 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "@anthropic-ai/sdk": "^0.78.0",
76
- "@langchain/core": "^1.2.1",
77
76
  "@napi-rs/canvas": "^0.1.80",
78
77
  "@types/sql.js": "^1.4.11",
79
78
  "@vscode/ripgrep": "^1.18.0",
80
- "langchain": "^1.5.2",
81
79
  "mammoth": "^1.12.0",
82
80
  "mysql2": "^3.23.1",
83
81
  "pdf-parse": "^2.4.5",