@geminixiang/mikan 1.0.0-beta.50 → 1.0.0-beta.52
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 +18 -0
- package/dist/harness/runner.d.ts.map +1 -1
- package/dist/harness/runner.js +3 -3
- package/dist/harness/runner.js.map +1 -1
- package/dist/harness/session-store.d.ts.map +1 -1
- package/dist/harness/session-store.js +10 -7
- package/dist/harness/session-store.js.map +1 -1
- package/dist/harness/subagent-profiles.d.ts.map +1 -1
- package/dist/harness/subagent-profiles.js +0 -15
- package/dist/harness/subagent-profiles.js.map +1 -1
- package/dist/harness/subagent-runner.d.ts.map +1 -1
- package/dist/harness/subagent-runner.js +2 -39
- package/dist/harness/subagent-runner.js.map +1 -1
- package/dist/harness/types.d.ts +0 -3
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,KAAK,EACL,YAAY,EACZ,aAAa,EACb,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEzD,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC;AAEjE,2EAA2E;AAC3E,MAAM,WAAW,c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AAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAClF;IACE,IAAI,EAAE,iBAAiB,CAAC;IACxB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjF,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACzC,KAAK,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;KAClC,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC","sourcesContent":["/**\n * Core types for the mikan agent harness.\n *\n * The harness is built directly on pi-agent-core and pi-ai. Sessions use\n * pi's current v4 entry model and JSONL storage format. mikan-owned\n * metadata uses a namespaced durable value; legacy v3 and Pi 0.84 v4 files\n * are handled exclusively by the offline session migrations.\n */\nimport type {\n AgentEvent,\n AgentMessage,\n AgentTool,\n BranchSummaryEntry,\n CompactionEntry,\n CustomEntry,\n Entry,\n MessageEntry,\n ThinkingLevel,\n CompactionSettings,\n} from \"@earendil-works/pi-agent-core\";\nimport type { Api, Model, RetryPolicy, Usage } from \"@earendil-works/pi-ai\";\nimport type { MikanModels } from \"./models.js\";\nimport type { SessionStore } from \"./session-store.js\";\nimport type { Static, TSchema } from \"@sinclair/typebox\";\n\nexport type { BranchSummaryEntry, CompactionEntry, CustomEntry };\n\n/** Model-visible messages reconstructed from the active session branch. */\nexport interface SessionContext {\n messages: AgentMessage[];\n}\n\n/** Message entry as stored in mikan session files (pi v4). */\nexport type SessionMessageEntry = MessageEntry;\n\n/** Union of entry types mikan reads and writes. Alias of pi's v4 entry. */\nexport type SessionEntry = Entry;\n\nexport const CURRENT_SESSION_VERSION = 4;\n\nexport interface SessionCreateInfo {\n id?: string;\n parentSession?: string;\n parentSessionId?: string;\n}\n\n/** Immutable session queries available to portals, admin, and migration code. */\nexport interface SessionInspection {\n getHeader(): SessionHeader;\n getEntries(): Promise<Entry[]>;\n getSessionName(): Promise<string | undefined>;\n getBranch(fromId?: string): Promise<Entry[]>;\n buildSessionContext(): Promise<SessionContext>;\n}\n\nexport interface SubagentModelSpec {\n provider: string;\n id: string;\n}\n\n/**\n * A curated capability set a subagent can be launched with. Built-ins ship\n * with the harness; `<workspaceDir>/agents/<name>.md` patches them per\n * installation. Turn, cost, and duration fields are caps — an explicit\n * `request.budget` may tighten them but never raise them. Token budgets use the\n * larger of the profile default and the request value.\n */\nexport interface SubagentProfile {\n name: string;\n description: string;\n systemPrompt: string;\n tools: string[];\n requiredTools: string[];\n model?: SubagentModelSpec;\n thinkingLevel?: ThinkingLevel;\n maxTurns?: number;\n maxTokens?: number;\n maxCostUsd?: number;\n maxDurationMs?: number;\n}\n\nexport interface SubagentRunBudget {\n /** Maximum assistant/model calls in the subagent run. */\n maxTurns?: number;\n /** Maximum cumulative input/output/cache tokens. */\n maxTokens?: number;\n /** Maximum provider cost in USD. */\n maxCostUsd?: number;\n /** Maximum wall-clock duration. */\n maxDurationMs?: number;\n}\n\nexport type SubagentRunStatus =\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"timeout\"\n | \"budget_exceeded\"\n | \"invalid_output\";\n\nexport interface SubagentParentContext {\n mode: \"normalized\";\n /** Number of recent user/assistant turns to include. Defaults to 3. */\n recentTurns?: number;\n}\n\n/** Aggregated model usage across every assistant turn in a subagent run. */\nexport type SubagentUsage = Usage;\n\n/** Receives usage from a subagent run, including after detached cleanup settles. */\nexport type SubagentUsageSink = (usage: SubagentUsage) => void | Promise<void>;\n\n/** A fresh, isolated subagent run. */\nexport interface SubagentRunRequest<TOutputSchema extends TSchema | undefined = undefined> {\n task: string;\n /** Named profile: a harness built-in, patched by `<workspaceDir>/agents/<name>.md`. */\n profile?: string;\n /** Opt in to a normalized textual snapshot of the active parent run. Defaults to fresh. */\n parentContext?: SubagentParentContext;\n systemPrompt?: string;\n /** JSON-serializable input appended to the task. */\n input?: unknown;\n /** Defaults to the parent runner's configured model. */\n model?: SubagentModelSpec;\n /** Tool names explicitly granted to the subagent. Defaults to no tools. */\n tools?: string[];\n /** Tool names that must each be invoked at least once before completion. */\n requiredTools?: string[];\n /** Per-profile thinking override. */\n thinkingLevel?: ThinkingLevel;\n /** When present, the final response must be JSON matching this schema. */\n outputSchema?: TOutputSchema;\n budget?: SubagentRunBudget;\n signal?: AbortSignal;\n}\n\nexport type SubagentRunOutput<TSchemaOrUndefined extends TSchema | undefined> =\n TSchemaOrUndefined extends TSchema ? Static<TSchemaOrUndefined> : string;\n\ninterface SubagentRunMetadata {\n runId: string;\n /** Raw final assistant text, including when structured validation failed. */\n text?: string;\n model: SubagentModelSpec;\n turns: number;\n toolCalls: number;\n toolCallCounts: Record<string, number>;\n /** Full token and cost breakdown across the run. */\n usage: SubagentUsage;\n /** Aggregate token count; equivalent to `usage.totalTokens`. */\n tokens: number;\n /** Aggregate provider cost; equivalent to `usage.cost.total`. */\n costUsd: number;\n durationMs: number;\n /**\n * The caller received a terminal result before the underlying run settled.\n * When true, `usage`, `tokens`, and `costUsd` are provisional snapshots;\n * final usage is delivered later through the run's bound usage sink. The\n * global slot remains held until cleanup settles because in-process work\n * cannot be safely reclaimed without a killable execution boundary.\n */\n cleanupPending?: boolean;\n}\n\ninterface SubagentRunCompletedResult<TOutput> extends SubagentRunMetadata {\n status: \"completed\";\n output: TOutput;\n error?: never;\n}\n\ninterface SubagentRunIncompleteResult extends SubagentRunMetadata {\n status: Exclude<SubagentRunStatus, \"completed\">;\n output?: never;\n error?: string;\n}\n\nexport type SubagentRunResult<TOutput = string> =\n | SubagentRunCompletedResult<TOutput>\n | SubagentRunIncompleteResult;\n\n/**\n * Compatibility header view synthesized from the v4 file header for callers\n * that read mikan session lineage. `metadata` carries mikan header extras (for\n * example `parentSessionPath` and the legacy `source` marker preserved by\n * the v3 migration).\n */\nexport interface SessionHeader {\n type: \"session\";\n version?: number;\n id: string;\n timestamp: string;\n cwd: string;\n parentSession?: string;\n parentSessionId?: string;\n [extra: string]: unknown;\n}\n\nexport interface CreateMikanModelsOptions {\n modelsJsonPath?: string;\n}\n\nexport type EventConversationKind = \"direct\" | \"shared\";\n\nexport type EventType = \"immediate\" | \"one-shot\" | \"periodic\";\n\ninterface EventPayloadBase {\n /** Target platform; may be omitted when only one platform is running. */\n platform?: string;\n conversationId: string;\n conversationKind?: EventConversationKind;\n userId?: string;\n /** Self-contained task text; event runs do not inherit conversation history. */\n text: string;\n}\n\nexport interface ImmediateEventPayload extends EventPayloadBase {\n type: \"immediate\";\n}\n\nexport interface OneShotEventPayload extends EventPayloadBase {\n type: \"one-shot\";\n /** ISO 8601 timestamp with offset. */\n at: string;\n}\n\nexport interface PeriodicEventPayload extends EventPayloadBase {\n type: \"periodic\";\n /** Cron expression (croner syntax). */\n schedule: string;\n /** IANA timezone, e.g. \"Asia/Taipei\". */\n timezone: string;\n}\n\n/** Wire shape of one event file. */\nexport type EventFilePayload = ImmediateEventPayload | OneShotEventPayload | PeriodicEventPayload;\n\nexport interface EventPayloadInput {\n type: EventType;\n platform?: string;\n conversationId: string;\n conversationKind?: EventConversationKind;\n userId?: string;\n text: string;\n at?: string;\n schedule?: string;\n timezone?: string;\n}\n\n/** A loaded skill. `baseDir` is the directory containing the skill file. */\nexport interface MikanSkill {\n name: string;\n description: string;\n /** Full skill instructions (file content without frontmatter). */\n content: string;\n filePath: string;\n baseDir: string;\n /** Where the skill was loaded from (e.g. \"workspace\", \"channel\"). */\n source: string;\n /** Exclude from model-visible skill lists. */\n disableModelInvocation?: boolean;\n /** Embed the skill body in the prompt instead of referencing its file path. */\n inline?: boolean;\n}\n\nexport interface SkillDiagnostic {\n type: \"warning\";\n message: string;\n path: string;\n /** Set when the entry was skipped because it is a symlink on a rejecting load. */\n code?: \"symlink\";\n}\n\nexport interface LoadSkillsResult {\n skills: MikanSkill[];\n diagnostics: SkillDiagnostic[];\n}\n\nexport type RetrySettings = RetryPolicy;\n\nexport interface BudgetSettings {\n /** Max cumulative tokens processed this run (input + output + cache read/write). */\n maxTokens?: number;\n /** Max cumulative provider cost (USD) this run. Requires a populated model cost table. */\n maxCostUsd?: number;\n /** Max wall-clock duration for the run, in milliseconds. */\n maxDurationMs?: number;\n /** Max number of LLM calls (assistant turns) this run. */\n maxLlmCalls?: number;\n}\n\nexport interface HarnessSettings {\n compaction: CompactionSettings;\n retry: RetrySettings;\n budget: BudgetSettings;\n}\n\nexport interface SubagentProfileDiagnostic {\n type: \"warning\";\n message: string;\n path: string;\n}\n\nexport interface LoadSubagentProfilesResult {\n profiles: Map<string, SubagentProfile>;\n diagnostics: SubagentProfileDiagnostic[];\n}\n\nexport type CompactionReason = \"threshold\" | \"overflow\" | \"manual\";\n\ninterface CompactionResultSummary {\n summary: string;\n /** Number of recent messages retained inline on the compaction entry. */\n retainedMessages: number;\n tokensBefore: number;\n}\n\nexport type HarnessEvent =\n | AgentEvent\n | { type: \"compaction_start\"; reason: CompactionReason }\n | {\n type: \"compaction_end\";\n reason: CompactionReason;\n result?: CompactionResultSummary;\n aborted: boolean;\n errorMessage?: string;\n }\n | {\n type: \"auto_retry_start\";\n attempt: number;\n maxAttempts: number;\n delayMs: number;\n errorMessage: string;\n }\n | { type: \"auto_retry_end\"; success: boolean; attempt: number; finalError?: string }\n | {\n type: \"budget_exceeded\";\n /** Which cap was hit, e.g. \"cost 2.01 USD > 2 USD limit\". */\n reason: string;\n tokens: number;\n costUsd: number;\n llmCalls: number;\n durationMs: number;\n };\n\nexport type HarnessEventListener = (event: HarnessEvent) => void | Promise<void>;\n\nexport interface MikanAgentSessionOptions {\n systemPrompt: string;\n model: Model<Api>;\n thinkingLevel: ThinkingLevel;\n tools: AgentTool[];\n models: MikanModels;\n sessionStore: SessionStore;\n settings?: {\n compaction?: Partial<CompactionSettings>;\n retry?: Partial<RetrySettings>;\n budget?: Partial<BudgetSettings>;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC","sourcesContent":["/**\n * Core types for the mikan agent harness.\n *\n * The harness is built directly on pi-agent-core and pi-ai. Sessions use\n * pi's current v4 entry model and JSONL storage format. mikan-owned\n * metadata uses a namespaced durable value; legacy v3 and Pi 0.84 v4 files\n * are handled exclusively by the offline session migrations.\n */\nimport type {\n AgentEvent,\n AgentMessage,\n AgentTool,\n BranchSummaryEntry,\n CompactionEntry,\n CustomEntry,\n Entry,\n MessageEntry,\n ThinkingLevel,\n CompactionSettings,\n} from \"@earendil-works/pi-agent-core\";\nimport type { Api, Model, RetryPolicy, Usage } from \"@earendil-works/pi-ai\";\nimport type { MikanModels } from \"./models.js\";\nimport type { SessionStore } from \"./session-store.js\";\nimport type { Static, TSchema } from \"@sinclair/typebox\";\n\nexport type { BranchSummaryEntry, CompactionEntry, CustomEntry };\n\n/** Model-visible messages reconstructed from the active session branch. */\nexport interface SessionContext {\n messages: AgentMessage[];\n}\n\n/** Message entry as stored in mikan session files (pi v4). */\nexport type SessionMessageEntry = MessageEntry;\n\n/** Union of entry types mikan reads and writes. Alias of pi's v4 entry. */\nexport type SessionEntry = Entry;\n\nexport const CURRENT_SESSION_VERSION = 4;\n\nexport interface SessionCreateInfo {\n id?: string;\n parentSession?: string;\n parentSessionId?: string;\n}\n\n/** Immutable session queries available to portals, admin, and migration code. */\nexport interface SessionInspection {\n getHeader(): SessionHeader;\n getEntries(): Promise<Entry[]>;\n getSessionName(): Promise<string | undefined>;\n getBranch(fromId?: string): Promise<Entry[]>;\n buildSessionContext(): Promise<SessionContext>;\n}\n\nexport interface SubagentModelSpec {\n provider: string;\n id: string;\n}\n\n/**\n * A curated capability set a subagent can be launched with. Built-ins ship\n * with the harness; `<workspaceDir>/agents/<name>.md` patches them per\n * installation. Turn, cost, and duration fields are caps — an explicit\n * `request.budget` may tighten them but never raise them. Token budgets use the\n * larger of the profile default and the request value.\n */\nexport interface SubagentProfile {\n name: string;\n description: string;\n systemPrompt: string;\n tools: string[];\n model?: SubagentModelSpec;\n thinkingLevel?: ThinkingLevel;\n maxTurns?: number;\n maxTokens?: number;\n maxCostUsd?: number;\n maxDurationMs?: number;\n}\n\nexport interface SubagentRunBudget {\n /** Maximum assistant/model calls in the subagent run. */\n maxTurns?: number;\n /** Maximum cumulative input/output/cache tokens. */\n maxTokens?: number;\n /** Maximum provider cost in USD. */\n maxCostUsd?: number;\n /** Maximum wall-clock duration. */\n maxDurationMs?: number;\n}\n\nexport type SubagentRunStatus =\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"timeout\"\n | \"budget_exceeded\"\n | \"invalid_output\";\n\nexport interface SubagentParentContext {\n mode: \"normalized\";\n /** Number of recent user/assistant turns to include. Defaults to 3. */\n recentTurns?: number;\n}\n\n/** Aggregated model usage across every assistant turn in a subagent run. */\nexport type SubagentUsage = Usage;\n\n/** Receives usage from a subagent run, including after detached cleanup settles. */\nexport type SubagentUsageSink = (usage: SubagentUsage) => void | Promise<void>;\n\n/** A fresh, isolated subagent run. */\nexport interface SubagentRunRequest<TOutputSchema extends TSchema | undefined = undefined> {\n task: string;\n /** Named profile: a harness built-in, patched by `<workspaceDir>/agents/<name>.md`. */\n profile?: string;\n /** Opt in to a normalized textual snapshot of the active parent run. Defaults to fresh. */\n parentContext?: SubagentParentContext;\n systemPrompt?: string;\n /** JSON-serializable input appended to the task. */\n input?: unknown;\n /** Defaults to the parent runner's configured model. */\n model?: SubagentModelSpec;\n /** Tool names explicitly granted to the subagent. Defaults to no tools. */\n tools?: string[];\n /** Per-profile thinking override. */\n thinkingLevel?: ThinkingLevel;\n /** When present, the final response must be JSON matching this schema. */\n outputSchema?: TOutputSchema;\n budget?: SubagentRunBudget;\n signal?: AbortSignal;\n}\n\nexport type SubagentRunOutput<TSchemaOrUndefined extends TSchema | undefined> =\n TSchemaOrUndefined extends TSchema ? Static<TSchemaOrUndefined> : string;\n\ninterface SubagentRunMetadata {\n runId: string;\n /** Raw final assistant text, including when structured validation failed. */\n text?: string;\n model: SubagentModelSpec;\n turns: number;\n toolCalls: number;\n toolCallCounts: Record<string, number>;\n /** Full token and cost breakdown across the run. */\n usage: SubagentUsage;\n /** Aggregate token count; equivalent to `usage.totalTokens`. */\n tokens: number;\n /** Aggregate provider cost; equivalent to `usage.cost.total`. */\n costUsd: number;\n durationMs: number;\n /**\n * The caller received a terminal result before the underlying run settled.\n * When true, `usage`, `tokens`, and `costUsd` are provisional snapshots;\n * final usage is delivered later through the run's bound usage sink. The\n * global slot remains held until cleanup settles because in-process work\n * cannot be safely reclaimed without a killable execution boundary.\n */\n cleanupPending?: boolean;\n}\n\ninterface SubagentRunCompletedResult<TOutput> extends SubagentRunMetadata {\n status: \"completed\";\n output: TOutput;\n error?: never;\n}\n\ninterface SubagentRunIncompleteResult extends SubagentRunMetadata {\n status: Exclude<SubagentRunStatus, \"completed\">;\n output?: never;\n error?: string;\n}\n\nexport type SubagentRunResult<TOutput = string> =\n | SubagentRunCompletedResult<TOutput>\n | SubagentRunIncompleteResult;\n\n/**\n * Compatibility header view synthesized from the v4 file header for callers\n * that read mikan session lineage. `metadata` carries mikan header extras (for\n * example `parentSessionPath` and the legacy `source` marker preserved by\n * the v3 migration).\n */\nexport interface SessionHeader {\n type: \"session\";\n version?: number;\n id: string;\n timestamp: string;\n cwd: string;\n parentSession?: string;\n parentSessionId?: string;\n [extra: string]: unknown;\n}\n\nexport interface CreateMikanModelsOptions {\n modelsJsonPath?: string;\n}\n\nexport type EventConversationKind = \"direct\" | \"shared\";\n\nexport type EventType = \"immediate\" | \"one-shot\" | \"periodic\";\n\ninterface EventPayloadBase {\n /** Target platform; may be omitted when only one platform is running. */\n platform?: string;\n conversationId: string;\n conversationKind?: EventConversationKind;\n userId?: string;\n /** Self-contained task text; event runs do not inherit conversation history. */\n text: string;\n}\n\nexport interface ImmediateEventPayload extends EventPayloadBase {\n type: \"immediate\";\n}\n\nexport interface OneShotEventPayload extends EventPayloadBase {\n type: \"one-shot\";\n /** ISO 8601 timestamp with offset. */\n at: string;\n}\n\nexport interface PeriodicEventPayload extends EventPayloadBase {\n type: \"periodic\";\n /** Cron expression (croner syntax). */\n schedule: string;\n /** IANA timezone, e.g. \"Asia/Taipei\". */\n timezone: string;\n}\n\n/** Wire shape of one event file. */\nexport type EventFilePayload = ImmediateEventPayload | OneShotEventPayload | PeriodicEventPayload;\n\nexport interface EventPayloadInput {\n type: EventType;\n platform?: string;\n conversationId: string;\n conversationKind?: EventConversationKind;\n userId?: string;\n text: string;\n at?: string;\n schedule?: string;\n timezone?: string;\n}\n\n/** A loaded skill. `baseDir` is the directory containing the skill file. */\nexport interface MikanSkill {\n name: string;\n description: string;\n /** Full skill instructions (file content without frontmatter). */\n content: string;\n filePath: string;\n baseDir: string;\n /** Where the skill was loaded from (e.g. \"workspace\", \"channel\"). */\n source: string;\n /** Exclude from model-visible skill lists. */\n disableModelInvocation?: boolean;\n /** Embed the skill body in the prompt instead of referencing its file path. */\n inline?: boolean;\n}\n\nexport interface SkillDiagnostic {\n type: \"warning\";\n message: string;\n path: string;\n /** Set when the entry was skipped because it is a symlink on a rejecting load. */\n code?: \"symlink\";\n}\n\nexport interface LoadSkillsResult {\n skills: MikanSkill[];\n diagnostics: SkillDiagnostic[];\n}\n\nexport type RetrySettings = RetryPolicy;\n\nexport interface BudgetSettings {\n /** Max cumulative tokens processed this run (input + output + cache read/write). */\n maxTokens?: number;\n /** Max cumulative provider cost (USD) this run. Requires a populated model cost table. */\n maxCostUsd?: number;\n /** Max wall-clock duration for the run, in milliseconds. */\n maxDurationMs?: number;\n /** Max number of LLM calls (assistant turns) this run. */\n maxLlmCalls?: number;\n}\n\nexport interface HarnessSettings {\n compaction: CompactionSettings;\n retry: RetrySettings;\n budget: BudgetSettings;\n}\n\nexport interface SubagentProfileDiagnostic {\n type: \"warning\";\n message: string;\n path: string;\n}\n\nexport interface LoadSubagentProfilesResult {\n profiles: Map<string, SubagentProfile>;\n diagnostics: SubagentProfileDiagnostic[];\n}\n\nexport type CompactionReason = \"threshold\" | \"overflow\" | \"manual\";\n\ninterface CompactionResultSummary {\n summary: string;\n /** Number of recent messages retained inline on the compaction entry. */\n retainedMessages: number;\n tokensBefore: number;\n}\n\nexport type HarnessEvent =\n | AgentEvent\n | { type: \"compaction_start\"; reason: CompactionReason }\n | {\n type: \"compaction_end\";\n reason: CompactionReason;\n result?: CompactionResultSummary;\n aborted: boolean;\n errorMessage?: string;\n }\n | {\n type: \"auto_retry_start\";\n attempt: number;\n maxAttempts: number;\n delayMs: number;\n errorMessage: string;\n }\n | { type: \"auto_retry_end\"; success: boolean; attempt: number; finalError?: string }\n | {\n type: \"budget_exceeded\";\n /** Which cap was hit, e.g. \"cost 2.01 USD > 2 USD limit\". */\n reason: string;\n tokens: number;\n costUsd: number;\n llmCalls: number;\n durationMs: number;\n };\n\nexport type HarnessEventListener = (event: HarnessEvent) => void | Promise<void>;\n\nexport interface MikanAgentSessionOptions {\n systemPrompt: string;\n model: Model<Api>;\n thinkingLevel: ThinkingLevel;\n tools: AgentTool[];\n models: MikanModels;\n sessionStore: SessionStore;\n settings?: {\n compaction?: Partial<CompactionSettings>;\n retry?: Partial<RetrySettings>;\n budget?: Partial<BudgetSettings>;\n };\n}\n"]}
|