@monkey-mini-app/dsh-mini-app 0.1.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/cordis.patch.yml +6 -0
- package/lib/client.d.cts +35 -0
- package/lib/client.js +5462 -0
- package/lib/index.d.ts +140 -0
- package/lib/index.js +1094 -0
- package/package.json +90 -0
- package/skills/monkey-mini-app/SKILL.md +209 -0
- package/skills/monkey-mini-app/references/catalog.md +99 -0
- package/skills/monkey-mini-app/references/contracts/activity-feed.md +24 -0
- package/skills/monkey-mini-app/references/contracts/app-shell.md +28 -0
- package/skills/monkey-mini-app/references/contracts/attachment-gallery.md +22 -0
- package/skills/monkey-mini-app/references/contracts/autocomplete.md +16 -0
- package/skills/monkey-mini-app/references/contracts/cascader.md +25 -0
- package/skills/monkey-mini-app/references/contracts/code-block.md +15 -0
- package/skills/monkey-mini-app/references/contracts/code-editor.md +17 -0
- package/skills/monkey-mini-app/references/contracts/color-picker.md +14 -0
- package/skills/monkey-mini-app/references/contracts/comment-thread.md +24 -0
- package/skills/monkey-mini-app/references/contracts/confirm-dialog.md +19 -0
- package/skills/monkey-mini-app/references/contracts/copyable.md +13 -0
- package/skills/monkey-mini-app/references/contracts/currency-input.md +15 -0
- package/skills/monkey-mini-app/references/contracts/data-grid.md +87 -0
- package/skills/monkey-mini-app/references/contracts/date-picker.md +17 -0
- package/skills/monkey-mini-app/references/contracts/date-range-picker.md +26 -0
- package/skills/monkey-mini-app/references/contracts/date-time-picker.md +18 -0
- package/skills/monkey-mini-app/references/contracts/date-time-range-picker.md +24 -0
- package/skills/monkey-mini-app/references/contracts/description-list.md +13 -0
- package/skills/monkey-mini-app/references/contracts/detail-panel.md +27 -0
- package/skills/monkey-mini-app/references/contracts/diff-viewer.md +16 -0
- package/skills/monkey-mini-app/references/contracts/donut-chart.md +31 -0
- package/skills/monkey-mini-app/references/contracts/duration-input.md +14 -0
- package/skills/monkey-mini-app/references/contracts/env-badge.md +13 -0
- package/skills/monkey-mini-app/references/contracts/event-calendar.md +50 -0
- package/skills/monkey-mini-app/references/contracts/file-dropzone.md +14 -0
- package/skills/monkey-mini-app/references/contracts/file-tree.md +23 -0
- package/skills/monkey-mini-app/references/contracts/filter-bar.md +26 -0
- package/skills/monkey-mini-app/references/contracts/gantt.md +24 -0
- package/skills/monkey-mini-app/references/contracts/gauge.md +14 -0
- package/skills/monkey-mini-app/references/contracts/jira-wiki.md +53 -0
- package/skills/monkey-mini-app/references/contracts/jql-input.md +37 -0
- package/skills/monkey-mini-app/references/contracts/json-viewer.md +13 -0
- package/skills/monkey-mini-app/references/contracts/kanban-issue-panel.md +45 -0
- package/skills/monkey-mini-app/references/contracts/kanban.md +64 -0
- package/skills/monkey-mini-app/references/contracts/log-viewer.md +13 -0
- package/skills/monkey-mini-app/references/contracts/markdown-editor.md +24 -0
- package/skills/monkey-mini-app/references/contracts/markdown.md +14 -0
- package/skills/monkey-mini-app/references/contracts/mini-calendar.md +15 -0
- package/skills/monkey-mini-app/references/contracts/notification-center.md +23 -0
- package/skills/monkey-mini-app/references/contracts/number-field.md +17 -0
- package/skills/monkey-mini-app/references/contracts/page-header.md +25 -0
- package/skills/monkey-mini-app/references/contracts/password-field.md +14 -0
- package/skills/monkey-mini-app/references/contracts/phone-input.md +14 -0
- package/skills/monkey-mini-app/references/contracts/progress-ring.md +13 -0
- package/skills/monkey-mini-app/references/contracts/radar-chart.md +23 -0
- package/skills/monkey-mini-app/references/contracts/rating.md +15 -0
- package/skills/monkey-mini-app/references/contracts/relative-date-picker.md +24 -0
- package/skills/monkey-mini-app/references/contracts/request-inspector.md +16 -0
- package/skills/monkey-mini-app/references/contracts/rich-text-editor.md +15 -0
- package/skills/monkey-mini-app/references/contracts/run-timeline.md +24 -0
- package/skills/monkey-mini-app/references/contracts/scrollspy.md +13 -0
- package/skills/monkey-mini-app/references/contracts/search-input.md +17 -0
- package/skills/monkey-mini-app/references/contracts/severity-chip.md +13 -0
- package/skills/monkey-mini-app/references/contracts/slider-range.md +16 -0
- package/skills/monkey-mini-app/references/contracts/sortable-list.md +23 -0
- package/skills/monkey-mini-app/references/contracts/sparkline.md +13 -0
- package/skills/monkey-mini-app/references/contracts/stacked-bar-chart.md +23 -0
- package/skills/monkey-mini-app/references/contracts/stat-card.md +27 -0
- package/skills/monkey-mini-app/references/contracts/status-badge.md +24 -0
- package/skills/monkey-mini-app/references/contracts/stepper.md +26 -0
- package/skills/monkey-mini-app/references/contracts/tag-input.md +15 -0
- package/skills/monkey-mini-app/references/contracts/terminal.md +13 -0
- package/skills/monkey-mini-app/references/contracts/test-step-list.md +23 -0
- package/skills/monkey-mini-app/references/contracts/time-picker.md +18 -0
- package/skills/monkey-mini-app/references/contracts/time-range-picker.md +23 -0
- package/skills/monkey-mini-app/references/contracts/time-wheel.md +29 -0
- package/skills/monkey-mini-app/references/contracts/timeline.md +24 -0
- package/skills/monkey-mini-app/references/contracts/timezone-select.md +27 -0
- package/skills/monkey-mini-app/references/contracts/transfer.md +24 -0
- package/skills/monkey-mini-app/references/contracts/tree-view.md +23 -0
- package/skills/monkey-mini-app/references/contracts/trend-card.md +26 -0
- package/skills/monkey-mini-app/references/contracts/user-picker.md +24 -0
- package/skills/monkey-mini-app/references/ctx.md +137 -0
- package/skills/monkey-mini-app/references/history.md +10 -0
- package/skills/monkey-mini-app/references/icons.md +83 -0
- package/skills/monkey-mini-app/references/llm-json.md +69 -0
- package/skills/monkey-mini-app/references/loader.md +30 -0
- package/skills/monkey-mini-app/references/test.md +30 -0
- package/skills/monkey-mini-app/references/tools.md +21 -0
- package/skills/monkey-mini-app/references/troubleshoot.md +12 -0
- package/skills/monkey-mini-app/templates/README.md +24 -0
- package/skills/monkey-mini-app/templates/agentrun/main.api.ts +78 -0
- package/skills/monkey-mini-app/templates/agentrun/manifest.json +9 -0
- package/skills/monkey-mini-app/templates/agentrun/ui.tsx +125 -0
- package/skills/monkey-mini-app/templates/insights/lib/sample.ts +17 -0
- package/skills/monkey-mini-app/templates/insights/main.api.ts +101 -0
- package/skills/monkey-mini-app/templates/insights/manifest.json +9 -0
- package/skills/monkey-mini-app/templates/insights/ui.tsx +138 -0
- package/skills/monkey-mini-app/templates/jira/main.api.ts +115 -0
- package/skills/monkey-mini-app/templates/jira/manifest.json +9 -0
- package/skills/monkey-mini-app/templates/jira/ui.tsx +318 -0
- package/skills/monkey-mini-app/templates/minimal/main.api.ts +16 -0
- package/skills/monkey-mini-app/templates/minimal/manifest.json +8 -0
- package/skills/monkey-mini-app/templates/minimal/ui.tsx +74 -0
- package/skills/monkey-mini-app/templates/monitor/main.api.ts +91 -0
- package/skills/monkey-mini-app/templates/monitor/manifest.json +9 -0
- package/skills/monkey-mini-app/templates/monitor/ui.tsx +176 -0
- package/skills/monkey-mini-app/templates/review/main.api.ts +68 -0
- package/skills/monkey-mini-app/templates/review/manifest.json +9 -0
- package/skills/monkey-mini-app/templates/review/ui.tsx +159 -0
- package/skills/monkey-mini-app/templates/todo/main.api.ts +83 -0
- package/skills/monkey-mini-app/templates/todo/manifest.json +8 -0
- package/skills/monkey-mini-app/templates/todo/ui.tsx +177 -0
- package/tsup.config.ts +68 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { HostConfig, AbsolutePath, AppCallContext, AgentRunOptions, HostCapabilities, LlmRunOptions, HostLifecycle, HostServices, LogLevel, ModelRouteOptions, JsonInstructOptions, ThemeResource, CustomThemePalette } from '@monkey-mini-app/host';
|
|
2
|
+
|
|
3
|
+
type DshPluginConfig = {
|
|
4
|
+
runtimeRoot?: string;
|
|
5
|
+
};
|
|
6
|
+
/** Locate runtimeRoot from plugin config only when provided; else bootstrap seed path. */
|
|
7
|
+
declare function resolveRuntimeRoot(config?: DshPluginConfig): AbsolutePath;
|
|
8
|
+
/**
|
|
9
|
+
* Runtime load: read host.json, no field defaults.
|
|
10
|
+
* Missing file fails loud with an install/init hint.
|
|
11
|
+
*/
|
|
12
|
+
declare function loadPluginHostConfig(config?: DshPluginConfig): HostConfig;
|
|
13
|
+
|
|
14
|
+
type DshToolSchema = {
|
|
15
|
+
name?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
parameters?: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
type DshToolService = {
|
|
20
|
+
register?: (tool: unknown) => void | (() => void);
|
|
21
|
+
get?: (name: string) => unknown;
|
|
22
|
+
schemas?: (scope?: unknown) => DshToolSchema[];
|
|
23
|
+
list?: () => unknown;
|
|
24
|
+
/** Agent-scoped mask; `deny` / `allow` must name known global tools. */
|
|
25
|
+
restrict?: (filter: {
|
|
26
|
+
allow?: string[];
|
|
27
|
+
deny?: string[];
|
|
28
|
+
}) => () => void;
|
|
29
|
+
};
|
|
30
|
+
type DshLlmService = {
|
|
31
|
+
stream: (req: unknown) => AsyncIterable<unknown>;
|
|
32
|
+
};
|
|
33
|
+
type DshCtx = {
|
|
34
|
+
tools?: DshToolService;
|
|
35
|
+
get?: (name: string) => unknown;
|
|
36
|
+
provide?: (key: string, value: unknown) => void;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type DshAgentHelpers = {
|
|
41
|
+
SessionId: (id: string) => unknown;
|
|
42
|
+
createUserMessage: (input: {
|
|
43
|
+
content: unknown[];
|
|
44
|
+
source: unknown;
|
|
45
|
+
}) => unknown;
|
|
46
|
+
finalAssistantOutput: (events: readonly unknown[]) => unknown[] | undefined;
|
|
47
|
+
};
|
|
48
|
+
type AgentOneShotDeps = {
|
|
49
|
+
loadHelpers?: () => Promise<DshAgentHelpers | null>;
|
|
50
|
+
/** Override poll interval for tests (ms). */
|
|
51
|
+
pollMs?: number;
|
|
52
|
+
/** Mini-app call context (appId/appDir/signal/hostLlm). */
|
|
53
|
+
callCtx?: AppCallContext;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Run one ephemeral dsh Agent to completion and return the final assistant text.
|
|
57
|
+
* `opts` is caller intent (never mutated). Call facts come from `deps.callCtx`.
|
|
58
|
+
*/
|
|
59
|
+
declare function runDshAgentOneShot(dsh: DshCtx, goal: string, opts?: AgentRunOptions, deps?: AgentOneShotDeps): Promise<string>;
|
|
60
|
+
|
|
61
|
+
/** dsh ctx-facing capabilities. Fail loud when the host has no llm/agent/tool/mcp. */
|
|
62
|
+
declare class DshCapabilities implements HostCapabilities {
|
|
63
|
+
private readonly dsh;
|
|
64
|
+
constructor(dsh: DshCtx);
|
|
65
|
+
bash(_ctx: AppCallContext, command: string): Promise<{
|
|
66
|
+
stdout: string;
|
|
67
|
+
stderr: string;
|
|
68
|
+
exitCode: number;
|
|
69
|
+
}>;
|
|
70
|
+
llm(ctx: AppCallContext, prompt: string, opts?: LlmRunOptions): Promise<string>;
|
|
71
|
+
agent(ctx: AppCallContext, goal: string, opts?: AgentRunOptions): Promise<string>;
|
|
72
|
+
tool(_ctx: AppCallContext, name: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
73
|
+
mcp(_ctx: AppCallContext, name: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
74
|
+
credentials(_ctx: AppCallContext): Record<string, string>;
|
|
75
|
+
config(_ctx: AppCallContext): Record<string, unknown>;
|
|
76
|
+
listTools(_ctx: AppCallContext): unknown[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type DshLifecycleOptions = {
|
|
80
|
+
skillDest?: string;
|
|
81
|
+
};
|
|
82
|
+
/** dsh lifecycle: register mini_app_* tools, install skill, provide services. */
|
|
83
|
+
declare class DshLifecycle implements HostLifecycle {
|
|
84
|
+
private readonly ctx;
|
|
85
|
+
private readonly options;
|
|
86
|
+
private disposers;
|
|
87
|
+
constructor(ctx: DshCtx, options?: DshLifecycleOptions);
|
|
88
|
+
attach(_ctx: unknown, services: HostServices): Promise<void>;
|
|
89
|
+
detach(): Promise<void>;
|
|
90
|
+
onHostPortChanged(_port: number): void;
|
|
91
|
+
log(level: LogLevel, message: string, meta?: unknown): void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Same defaults as dsh `agent-default-model` / legacy dsh-adapter. */
|
|
95
|
+
declare const DSH_LLM_FALLBACK: {
|
|
96
|
+
readonly provider: "deepseek-official";
|
|
97
|
+
readonly model: "deepseek-v4-flash";
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Resolve provider/model for ctx.llm / ctx.agent.
|
|
101
|
+
* Follows call opts → AppCallContext.hostLlm → dsh config → agentDefaultModel → fallback.
|
|
102
|
+
* Never mutates opts.
|
|
103
|
+
*/
|
|
104
|
+
declare function resolveLlmRoute(ctx: DshCtx, opts?: ModelRouteOptions, hostLlm?: {
|
|
105
|
+
provider?: string;
|
|
106
|
+
model?: string;
|
|
107
|
+
}): {
|
|
108
|
+
provider: string;
|
|
109
|
+
model: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
declare function withJsonInstruction(prompt: string, opts?: JsonInstructOptions): {
|
|
113
|
+
prompt: string;
|
|
114
|
+
system: string | undefined;
|
|
115
|
+
};
|
|
116
|
+
/** When opts.schema is set, peel markdown / preamble so JSON.parse in apps can succeed. */
|
|
117
|
+
declare function coerceSchemaJson(text: string, opts?: JsonInstructOptions): string;
|
|
118
|
+
/** dsh 流格式收集:只收 text-delta + block-end(忽略 reasoning-* / usage)。 */
|
|
119
|
+
declare function collectLlmStream(llmSvc: DshLlmService, prompt: string, route: Required<ModelRouteOptions>, opts?: LlmRunOptions): Promise<string>;
|
|
120
|
+
|
|
121
|
+
declare function getSkillDir(): string;
|
|
122
|
+
declare function getSkillMarkdown(): string;
|
|
123
|
+
/** Load all files under a named template as path → content (relative to template root). */
|
|
124
|
+
declare function getTemplateFiles(name: string): Record<string, string>;
|
|
125
|
+
declare function getSkeletonTemplateFiles(): Record<string, string>;
|
|
126
|
+
|
|
127
|
+
declare class DshThemeResource implements ThemeResource {
|
|
128
|
+
private readonly runtimeRoot;
|
|
129
|
+
constructor(runtimeRoot: string);
|
|
130
|
+
runnerCss(): string;
|
|
131
|
+
listCustomPalettes(): CustomThemePalette[];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
declare const packageName = "@monkey-mini-app/dsh-mini-app";
|
|
135
|
+
declare const name = "monkey-mini-app";
|
|
136
|
+
declare const inject: string[];
|
|
137
|
+
|
|
138
|
+
declare function apply(ctx: DshCtx, config?: DshPluginConfig): Promise<() => void>;
|
|
139
|
+
|
|
140
|
+
export { type AgentOneShotDeps, DSH_LLM_FALLBACK, type DshAgentHelpers, DshCapabilities, type DshCtx, DshLifecycle, type DshPluginConfig, DshThemeResource, apply, coerceSchemaJson, collectLlmStream, getSkeletonTemplateFiles, getSkillDir, getSkillMarkdown, getTemplateFiles, inject, loadPluginHostConfig, name, packageName, resolveLlmRoute, resolveRuntimeRoot, runDshAgentOneShot, withJsonInstruction };
|