@co0ontty/wand 4.57.0 → 4.58.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/dist/build-info.json +3 -3
- package/dist/ensure-node-pty-helper.d.ts +0 -1
- package/dist/ensure-node-pty-helper.js +0 -5
- package/dist/git-quick-commit.js +18 -19
- package/dist/github-connector.d.ts +11 -5
- package/dist/github-connector.js +105 -33
- package/dist/missions.d.ts +1 -1
- package/dist/missions.js +17 -4
- package/dist/server-file-routes.js +43 -2
- package/dist/server-github-routes.js +50 -53
- package/dist/server-mission-routes.js +11 -10
- package/dist/server-task-routes.d.ts +14 -2
- package/dist/server-task-routes.js +248 -84
- package/dist/server-workspace-routes.js +90 -16
- package/dist/server.js +2 -20
- package/dist/storage.d.ts +23 -6
- package/dist/storage.js +130 -53
- package/dist/structured-exec-host.d.ts +13 -2
- package/dist/structured-exec-host.js +71 -36
- package/dist/structured-exec-pump.d.ts +1 -1
- package/dist/structured-exec-pump.js +14 -8
- package/dist/task-types.d.ts +15 -0
- package/dist/terminal-daemon-client.d.ts +2 -0
- package/dist/terminal-daemon-client.js +7 -1
- package/dist/terminal-daemon-server.js +17 -18
- package/dist/tui/ipc-server.js +3 -1
- package/dist/types.d.ts +1 -0
- package/dist/wand-task-sync.d.ts +9 -0
- package/dist/wand-task-sync.js +50 -0
- package/dist/web-ui/content/scripts.js +85 -85
- package/dist/web-ui/content/styles.css +1 -1
- package/dist/web-ui/embedded-assets.js +2 -2
- package/dist/ws-broadcast.js +5 -1
- package/package.json +2 -3
- package/dist/taskboard-bridge.d.ts +0 -11
- package/dist/taskboard-bridge.js +0 -371
- package/vendor/codex-taskboard/LICENSE +0 -201
- package/vendor/codex-taskboard/dist/web/assets/AiChat-BNn4VJ5a.js +0 -12
- package/vendor/codex-taskboard/dist/web/assets/GanttView-D8wnfGrG.css +0 -1
- package/vendor/codex-taskboard/dist/web/assets/GanttView-rGWhuEX9.js +0 -39
- package/vendor/codex-taskboard/dist/web/assets/abnfDiagram-N423BO3Z-DbFG6lbA.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/arc-BjSQqbzd.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/architecture-TIHT7OUA-C9-t8p4o.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/architectureDiagram-T3A2C74G-Db4kJZwO.js +0 -36
- package/vendor/codex-taskboard/dist/web/assets/array-BifhSqXX.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/blockDiagram-VBNYF7ZC-C-BywuWV.js +0 -132
- package/vendor/codex-taskboard/dist/web/assets/c4Diagram-5PPSVZJV-Dq-80rjP.js +0 -10
- package/vendor/codex-taskboard/dist/web/assets/channel-C7mnz8Xc.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-2GRJ4B5K-B2G57us9.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-2Q5K7J3B-C1jixKkw.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-3NCLNEKW-DVGIRib_.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-4I5QYGJK-kNoGFqr0.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-5RXB4S5H-4iv6-xM6.js +0 -231
- package/vendor/codex-taskboard/dist/web/assets/chunk-5VM5RSS4-ZNzvKenW.js +0 -15
- package/vendor/codex-taskboard/dist/web/assets/chunk-6Q2QTUOP-1J34vxHr.js +0 -88
- package/vendor/codex-taskboard/dist/web/assets/chunk-7BUUIJ7U-Bb538aSH.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-7Z6QIM7H-CDQpQlxX.js +0 -10
- package/vendor/codex-taskboard/dist/web/assets/chunk-GF5L2VYU-Dg92oHHl.js +0 -206
- package/vendor/codex-taskboard/dist/web/assets/chunk-I66GZJ75-Bk8_gFs2.js +0 -125
- package/vendor/codex-taskboard/dist/web/assets/chunk-J7OUQ5F2-CJRcenlr.js +0 -2
- package/vendor/codex-taskboard/dist/web/assets/chunk-JQJVKLGR-BLBV_Sus.js +0 -156
- package/vendor/codex-taskboard/dist/web/assets/chunk-JWPE2WC7-DVXcaiue.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-KBJHAD2P-Da9Yjz0p.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-KEIR6QF5-Dj-OpFgW.js +0 -161
- package/vendor/codex-taskboard/dist/web/assets/chunk-NSK5VX7P-Cb56tnGK.js +0 -2
- package/vendor/codex-taskboard/dist/web/assets/chunk-QR6OTTB3-BwoszTxn.js +0 -62
- package/vendor/codex-taskboard/dist/web/assets/chunk-RYQCIY6F-D_L2RdcQ.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-UBXNYLIW-YX5mN8cl.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-W5SLKNZC-DlOLhhDO.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-WRU74C26-B7SBmP0K.js +0 -70
- package/vendor/codex-taskboard/dist/web/assets/chunk-XXDRQBXY-BuE3VzE_.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/chunk-ZIRB5QZD-C6fEPe3t.js +0 -32
- package/vendor/codex-taskboard/dist/web/assets/classDiagram-JCYQIIEL-KIdCVvbA.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/classDiagram-v2-OCEON4UE-KIdCVvbA.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/cose-bilkent-JH36ORCC-BzQvy5TC.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/cynefin-VYW2F7L2-D1_5O1XR.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/cynefinDiagram-MW4NZA55-DOW_U5QN.js +0 -62
- package/vendor/codex-taskboard/dist/web/assets/cytoscape.esm-DnGd5Fuo.js +0 -321
- package/vendor/codex-taskboard/dist/web/assets/dagre-VZM6K2ZE-0Dntc3NT.js +0 -4
- package/vendor/codex-taskboard/dist/web/assets/dagre-dpRSp0QF.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/defaultLocale-C8Fc0cco.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/diagram-7IWD3JNH-D7GleYAM.js +0 -30
- package/vendor/codex-taskboard/dist/web/assets/diagram-B4RE2ZJO-DCXTe6q5.js +0 -3
- package/vendor/codex-taskboard/dist/web/assets/diagram-LBJQPF4R-ZFJyXEXl.js +0 -24
- package/vendor/codex-taskboard/dist/web/assets/diagram-Q27KOJAE-DUGCuGd9.js +0 -24
- package/vendor/codex-taskboard/dist/web/assets/diagram-UB23O5K3-DRmp4Nng.js +0 -41
- package/vendor/codex-taskboard/dist/web/assets/dist-D9sYb5Oa.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/ebnfDiagram-BXEA7PRR-CkKoaf7T.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/erDiagram-JOGREHBK-nBX5z4R4.js +0 -85
- package/vendor/codex-taskboard/dist/web/assets/eventmodeling-45OFAUF4-pexmK65N.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/flowDiagram-UKHOOZJN-aroohRbL.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/ganttDiagram-PKOTCBZU-BOJWUTXa.js +0 -292
- package/vendor/codex-taskboard/dist/web/assets/gitGraph-TEB2WS4Q-DxnuhSZU.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/gitGraphDiagram-DS77QQ5N-Cte975TC.js +0 -106
- package/vendor/codex-taskboard/dist/web/assets/graphlib-DS17s2tU.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/index-Docmx4uQ.css +0 -1
- package/vendor/codex-taskboard/dist/web/assets/index-Du07lEGz.js +0 -121
- package/vendor/codex-taskboard/dist/web/assets/info-DKCQHKI2-DOTjgYxk.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/infoDiagram-6WML65LV-SpyV9UJd.js +0 -2
- package/vendor/codex-taskboard/dist/web/assets/init-D6jRqBbL.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/ishikawaDiagram-WSZJBQD7-T0PZwoUZ.js +0 -70
- package/vendor/codex-taskboard/dist/web/assets/journeyDiagram-NVQOT4AX-B88b8UgX.js +0 -139
- package/vendor/codex-taskboard/dist/web/assets/kanban-definition-27J2QSJJ-CIlfNnl_.js +0 -89
- package/vendor/codex-taskboard/dist/web/assets/katex-B7rAX3Vi.js +0 -257
- package/vendor/codex-taskboard/dist/web/assets/line-fWrwPZhB.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/linear-B7l8qgEw.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/map-BaFkSB1l.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/mermaid-parser.core-C5gls2nC.js +0 -7
- package/vendor/codex-taskboard/dist/web/assets/mermaid.core-POz2Xcvr.js +0 -11
- package/vendor/codex-taskboard/dist/web/assets/mindmap-definition-FAOFIHXS-BM0-egZ5.js +0 -96
- package/vendor/codex-taskboard/dist/web/assets/ordinal-hYBb2elL.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/packet-7NZHBO7P-DQZzyVos.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/path-BWPyau1x.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/pegDiagram-VL7TDLO6-B8aEwl-7.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/pie-RZYD4A2V-DRUflilR.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/pieDiagram-7S7Q4E2Y-0cDDxlua.js +0 -39
- package/vendor/codex-taskboard/dist/web/assets/purify.es-Bwt4ulIK.js +0 -3
- package/vendor/codex-taskboard/dist/web/assets/quadrantDiagram-CIZ2JOQS-CBgb0YZ0.js +0 -7
- package/vendor/codex-taskboard/dist/web/assets/radar-I7S5WNFK-tRocoKxq.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/railroad-3IZDKUUU-DaS4ZlX_.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/railroad-abnf-AHOZXSZD-BN1T5dBT.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/railroad-ebnf-EBAXGLYW-Cuf8qyKs.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/railroad-peg-LSFZ7HO6-B511_EYq.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/railroadDiagram-AXF67PYL-QtPo-JZb.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/requirementDiagram-LRYGKXZP-CuBIF85r.js +0 -84
- package/vendor/codex-taskboard/dist/web/assets/rolldown-runtime-QTnfLwEv.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/rough.esm-CSKSodPl.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/sankeyDiagram-W5VNT64P-CRA-b_za.js +0 -40
- package/vendor/codex-taskboard/dist/web/assets/sequenceDiagram-SI44F4Z6-CoddVWwY.js +0 -162
- package/vendor/codex-taskboard/dist/web/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/src-_wZywoZs.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/stateDiagram-OKZ733FA-D8DMM2ln.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/stateDiagram-v2-UEYNNEHI-CVp0eYAS.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/swimlanes-SLNWSIFB-C1fC7EFu.js +0 -2
- package/vendor/codex-taskboard/dist/web/assets/swimlanesDiagram-ULZ7WXOC-CPd58Xso.js +0 -8
- package/vendor/codex-taskboard/dist/web/assets/timeline-definition-Z64GVDOM-BUBv8aKP.js +0 -120
- package/vendor/codex-taskboard/dist/web/assets/treeView-QDETBFTQ-C-Bve2kY.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/treemap-6X3UGDF4-BcphHDdV.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/vennDiagram-T6HMQDX7-0wQnwAyA.js +0 -34
- package/vendor/codex-taskboard/dist/web/assets/wardley-OPB4EBWU-CJZ4BevB.js +0 -1
- package/vendor/codex-taskboard/dist/web/assets/wardleyDiagram-T6FBY63Y-U9nwPrkN.js +0 -78
- package/vendor/codex-taskboard/dist/web/assets/xychartDiagram-ELKLHX3M-CyCqnzgE.js +0 -7
- package/vendor/codex-taskboard/dist/web/codex-agent-logo.png +0 -0
- package/vendor/codex-taskboard/dist/web/codex-app-icon.png +0 -0
- package/vendor/codex-taskboard/dist/web/favicon.svg +0 -7
- package/vendor/codex-taskboard/dist/web/index.html +0 -20
- package/vendor/codex-taskboard/server/ai-chat-catalog.mjs +0 -1031
- package/vendor/codex-taskboard/server/ai-chat-process.mjs +0 -462
- package/vendor/codex-taskboard/server/ai-chat.mjs +0 -1237
- package/vendor/codex-taskboard/server/ai-turn-owner.mjs +0 -39
- package/vendor/codex-taskboard/server/app.mjs +0 -3211
- package/vendor/codex-taskboard/server/cloud-config.mjs +0 -188
- package/vendor/codex-taskboard/server/cloud-proxy.mjs +0 -310
- package/vendor/codex-taskboard/server/codex-app-server.mjs +0 -376
- package/vendor/codex-taskboard/server/codex-slash-commands-0.139.0.json +0 -62
- package/vendor/codex-taskboard/server/database.mjs +0 -2845
- package/vendor/codex-taskboard/server/index.mjs +0 -41
- package/vendor/codex-taskboard/server/jira-config.mjs +0 -181
- package/vendor/codex-taskboard/server/jira-integration.mjs +0 -487
- package/vendor/codex-taskboard/server/project-summary.mjs +0 -159
- package/vendor/codex-taskboard/shared/api-fields.mjs +0 -163
- package/vendor/codex-taskboard/shared/codex-environment.mjs +0 -5
- package/vendor/codex-taskboard/shared/codex-executable.mjs +0 -77
- package/vendor/codex-taskboard/shared/codex-permissions.mjs +0 -9
- package/vendor/codex-taskboard/shared/composer-reference.d.mts +0 -19
- package/vendor/codex-taskboard/shared/composer-reference.mjs +0 -90
- package/vendor/codex-taskboard/shared/domain.mjs +0 -34
- package/vendor/codex-taskboard/shared/executable-command.mjs +0 -13
- package/vendor/codex-taskboard/shared/process-tree.mjs +0 -27
- package/vendor/codex-taskboard/shared/task-input.mjs +0 -308
- package/vendor/codex-taskboard/shared/task-records.mjs +0 -199
- package/vendor/codex-taskboard/shared/task-relations.mjs +0 -55
- package/vendor/codex-taskboard/shared/taskboard-automation.mjs +0 -277
- package/vendor/codex-taskboard/skills/manage-taskboard/SKILL.md +0 -45
- package/vendor/codex-taskboard/skills/manage-taskboard/agents/openai.yaml +0 -4
- package/vendor/codex-taskboard/skills/manage-taskboard/references/cli.md +0 -211
package/dist/ws-broadcast.js
CHANGED
|
@@ -449,8 +449,12 @@ export class WsBroadcastManager {
|
|
|
449
449
|
if (!usesPtyAckFlowControl
|
|
450
450
|
&& (client.backpressurePaused || client.sendQueue.length >= MAX_QUEUE_SIZE)) {
|
|
451
451
|
client.backpressurePaused = true;
|
|
452
|
-
|
|
452
|
+
// Dropped output, ended, and status are all reconstructable only via
|
|
453
|
+
// a fresh init. Recording only output left clients spinning when the
|
|
454
|
+
// last dropped frame was ended/status.
|
|
455
|
+
if (typeof event.sessionId === "string" && event.sessionId) {
|
|
453
456
|
client.pendingResyncSessions.add(event.sessionId);
|
|
457
|
+
}
|
|
454
458
|
this.processWsQueue(client);
|
|
455
459
|
continue;
|
|
456
460
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@co0ontty/wand",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.58.0",
|
|
4
4
|
"description": "A web console for Claude Code, Codex, OpenCode, and other local CLI tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
-
"browser-extension"
|
|
17
|
-
"vendor"
|
|
16
|
+
"browser-extension"
|
|
18
17
|
],
|
|
19
18
|
"preferGlobal": true,
|
|
20
19
|
"scripts": {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { RequestHandler } from "express";
|
|
2
|
-
import type { WandStorage } from "./storage.js";
|
|
3
|
-
import type { SessionRegistry } from "./session-registry.js";
|
|
4
|
-
import type { StructuredSessionManager } from "./structured-session-manager.js";
|
|
5
|
-
interface TaskboardBridge {
|
|
6
|
-
handler: RequestHandler;
|
|
7
|
-
close(): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
export declare function taskboardIntegrationScript(): string;
|
|
10
|
-
export declare function startTaskboardBridge(configDir: string, storage?: WandStorage, sessions?: SessionRegistry, structured?: StructuredSessionManager, fallbackCwd?: string): Promise<TaskboardBridge>;
|
|
11
|
-
export {};
|
package/dist/taskboard-bridge.js
DELETED
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
import { mkdir } from "node:fs/promises";
|
|
2
|
-
import { request as httpRequest } from "node:http";
|
|
3
|
-
import { createServer } from "node:net";
|
|
4
|
-
import { spawn } from "node:child_process";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
function freePort() {
|
|
8
|
-
return new Promise((resolve, reject) => {
|
|
9
|
-
const probe = createServer();
|
|
10
|
-
probe.once("error", reject);
|
|
11
|
-
probe.listen(0, "127.0.0.1", () => {
|
|
12
|
-
const address = probe.address();
|
|
13
|
-
if (!address || typeof address === "string") {
|
|
14
|
-
probe.close();
|
|
15
|
-
reject(new Error("无法分配任务面板端口。"));
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
probe.close((error) => error ? reject(error) : resolve(address.port));
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function waitForReady(port, child) {
|
|
23
|
-
return new Promise((resolve, reject) => {
|
|
24
|
-
const deadline = Date.now() + 15_000;
|
|
25
|
-
let timer;
|
|
26
|
-
const check = () => {
|
|
27
|
-
if (Date.now() > deadline) {
|
|
28
|
-
reject(new Error("任务面板服务启动超时。"));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const request = httpRequest({ hostname: "127.0.0.1", port, path: "/health", method: "GET", timeout: 1_000 }, (response) => {
|
|
32
|
-
response.resume();
|
|
33
|
-
if ((response.statusCode ?? 500) >= 200 && (response.statusCode ?? 500) < 300) {
|
|
34
|
-
clearTimeout(timer);
|
|
35
|
-
resolve();
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
timer = setTimeout(check, 100);
|
|
39
|
-
timer.unref();
|
|
40
|
-
});
|
|
41
|
-
request.on("error", () => { timer = setTimeout(check, 100); timer.unref(); });
|
|
42
|
-
request.end();
|
|
43
|
-
};
|
|
44
|
-
child.once("exit", (code) => { if (code !== null && code !== 0)
|
|
45
|
-
reject(new Error(`任务面板服务退出(${code})。`)); });
|
|
46
|
-
check();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function validId(value) {
|
|
50
|
-
return typeof value === "string" && value.length > 0 && value.length <= 256 && /^[A-Za-z0-9._:-]+$/.test(value);
|
|
51
|
-
}
|
|
52
|
-
export function taskboardIntegrationScript() {
|
|
53
|
-
return `<script>
|
|
54
|
-
(() => {
|
|
55
|
-
const query = new URLSearchParams(location.search);
|
|
56
|
-
const currentSessionId = query.get("wandSessionId") || "";
|
|
57
|
-
const originalFetch = window.fetch.bind(window);
|
|
58
|
-
window.fetch = (input, init = {}) => {
|
|
59
|
-
const headers = new Headers(init.headers || {});
|
|
60
|
-
if (currentSessionId) headers.set("X-Wand-Session-Id", currentSessionId);
|
|
61
|
-
return originalFetch(input, { ...init, headers });
|
|
62
|
-
};
|
|
63
|
-
const providerLabel = (provider) => ({claude:"Claude",codex:"Codex",opencode:"OpenCode",grok:"Grok",qoder:"Qoder",pi:"Pi"}[provider] || provider || "Agent");
|
|
64
|
-
const providers = ["claude", "codex", "opencode", "grok", "qoder", "pi"];
|
|
65
|
-
let catalogPromise;
|
|
66
|
-
const loadCatalog = () => catalogPromise || (catalogPromise = originalFetch("/api/models", {credentials:"same-origin"}).then((response) => response.ok ? response.json() : {}).catch(() => ({})));
|
|
67
|
-
const modelsFor = async (provider) => {
|
|
68
|
-
const catalog = await loadCatalog();
|
|
69
|
-
const entries = Array.isArray(catalog[provider + "Models"]) ? catalog[provider + "Models"] : [];
|
|
70
|
-
const fallback = catalog.defaultModels && catalog.defaultModels[provider] || catalog["default" + provider[0].toUpperCase() + provider.slice(1) + "Model"] || "";
|
|
71
|
-
const options = entries.map((entry) => ({id: String(entry.id || ""), label: String(entry.label || entry.id || "")})).filter((entry) => entry.id);
|
|
72
|
-
if (!options.some((entry) => entry.id === "default")) options.unshift({id:"default", label:fallback ? "跟随服务端默认(" + fallback + ")" : "跟随服务端默认"});
|
|
73
|
-
return options;
|
|
74
|
-
};
|
|
75
|
-
const style = document.createElement("style");
|
|
76
|
-
style.textContent = ".wand-session-links{display:flex;flex-wrap:wrap;align-items:center;gap:5px;margin-top:10px;padding-top:8px;border-top:1px solid color-mix(in srgb, currentColor 12%, transparent);font-size:11px}.wand-session-links button{border:1px solid color-mix(in srgb, currentColor 18%, transparent);border-radius:5px;padding:3px 7px;background:color-mix(in srgb, currentColor 5%, transparent);color:inherit;cursor:pointer;font:inherit}.wand-session-links button:hover{background:color-mix(in srgb, currentColor 12%, transparent)}.wand-session-link{color:#3678c9}.wand-session-bind,.wand-agent-assign{color:#777}.wand-session-empty,.wand-session-loading{opacity:.55}.wand-agent-dialog{border:0;border-radius:14px;padding:0;color:#202124;background:#fff;box-shadow:0 20px 70px rgb(0 0 0 / 28%);width:min(430px,calc(100vw - 32px))}.wand-agent-dialog::backdrop{background:rgb(0 0 0 / 35%);backdrop-filter:blur(3px)}.wand-agent-dialog form{display:grid;gap:14px;padding:20px}.wand-agent-dialog h2{margin:0;font-size:18px}.wand-agent-dialog p{margin:-6px 0 0;color:#6b7280;font-size:12px}.wand-agent-field{display:grid;gap:6px}.wand-agent-field label{font-size:12px;font-weight:650;color:#4b5563}.wand-agent-field select{min-height:34px;border:1px solid #d1d5db;border-radius:7px;padding:0 9px;background:#fff;color:#111827}.wand-agent-actions{display:flex;justify-content:flex-end;gap:8px}.wand-agent-actions button{border:1px solid #d1d5db;border-radius:7px;padding:7px 12px;background:#fff;cursor:pointer}.wand-agent-actions button[type=submit]{border-color:#2563eb;background:#2563eb;color:#fff}.wand-agent-error{margin:0;color:#b91c1c;font-size:12px}.wand-agent-assignment{color:#2563eb;font-weight:650}";
|
|
77
|
-
document.head.appendChild(style);
|
|
78
|
-
const openAssignDialog = async (taskId, card) => {
|
|
79
|
-
if (document.querySelector(".wand-agent-dialog")) return;
|
|
80
|
-
const dialog = document.createElement("dialog");
|
|
81
|
-
dialog.className = "wand-agent-dialog";
|
|
82
|
-
dialog.innerHTML = '<form method="dialog"><h2>指派 Wand Agent</h2><p>选择执行 Agent、模型和思考深度;创建后会话会自动绑定到此任务。</p><div class="wand-agent-field"><label for="wand-agent-provider">Agent</label><select id="wand-agent-provider" name="provider">' + providers.map((provider) => '<option value="' + provider + '">' + providerLabel(provider) + '</option>').join("") + '</select></div><div class="wand-agent-field"><label for="wand-agent-model">模型</label><select id="wand-agent-model" name="model"><option>加载中…</option></select></div><div class="wand-agent-field"><label for="wand-agent-effort">思考深度</label><select id="wand-agent-effort" name="thinkingEffort"><option value="off">关闭</option><option value="standard">标准</option><option value="deep">深入</option><option value="max">最大</option></select></div><p class="wand-agent-error" hidden></p><div class="wand-agent-actions"><button type="button" data-cancel>取消</button><button type="submit">开始执行</button></div></form>';
|
|
83
|
-
document.body.appendChild(dialog);
|
|
84
|
-
const form = dialog.querySelector("form");
|
|
85
|
-
const provider = dialog.querySelector("[name=provider]");
|
|
86
|
-
const model = dialog.querySelector("[name=model]");
|
|
87
|
-
const error = dialog.querySelector(".wand-agent-error");
|
|
88
|
-
const submit = dialog.querySelector("button[type=submit]");
|
|
89
|
-
const refreshModels = async () => {
|
|
90
|
-
const selected = provider.value;
|
|
91
|
-
model.innerHTML = '<option>加载中…</option>';
|
|
92
|
-
for (const entry of await modelsFor(selected)) {
|
|
93
|
-
const option = document.createElement("option"); option.value = entry.id; option.textContent = entry.label; model.appendChild(option);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
provider.addEventListener("change", () => void refreshModels());
|
|
97
|
-
dialog.querySelector("[data-cancel]").addEventListener("click", () => dialog.close());
|
|
98
|
-
form.addEventListener("submit", async (event) => {
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
error.hidden = true; submit.disabled = true; submit.textContent = "正在启动…";
|
|
101
|
-
try {
|
|
102
|
-
const response = await originalFetch("/taskboard/api/wand/assign", {method:"POST", headers:{"Content-Type":"application/json", "X-Wand-Session-Id":currentSessionId}, body:JSON.stringify({taskId, provider:provider.value, model:model.value, thinkingEffort:form.querySelector("[name=thinkingEffort]").value})});
|
|
103
|
-
const payload = await response.json().catch(() => ({}));
|
|
104
|
-
if (!response.ok) throw new Error(payload.error || "指派失败");
|
|
105
|
-
dialog.close();
|
|
106
|
-
dialog.remove();
|
|
107
|
-
card.querySelector(".wand-session-links")?.remove();
|
|
108
|
-
setup(card);
|
|
109
|
-
} catch (caught) {
|
|
110
|
-
error.textContent = caught instanceof Error ? caught.message : "指派失败";
|
|
111
|
-
error.hidden = false; submit.disabled = false; submit.textContent = "开始执行";
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
dialog.addEventListener("close", () => dialog.remove(), {once:true});
|
|
115
|
-
dialog.showModal();
|
|
116
|
-
await refreshModels();
|
|
117
|
-
};
|
|
118
|
-
const setup = (card) => {
|
|
119
|
-
const taskId = card.getAttribute("data-task-id");
|
|
120
|
-
if (!taskId) return;
|
|
121
|
-
let links = card.querySelector(".wand-session-links");
|
|
122
|
-
if (!links) {
|
|
123
|
-
links = document.createElement("div"); links.className = "wand-session-links";
|
|
124
|
-
links.innerHTML = '<span class="wand-session-loading">Wand 会话…</span>';
|
|
125
|
-
card.appendChild(links);
|
|
126
|
-
}
|
|
127
|
-
if (!links.querySelector(".wand-agent-assign")) {
|
|
128
|
-
const assign = document.createElement("button");
|
|
129
|
-
assign.type = "button"; assign.className = "wand-agent-assign"; assign.textContent = "+ 指派 Agent";
|
|
130
|
-
assign.onclick = (event) => { event.stopPropagation(); event.preventDefault(); void openAssignDialog(taskId, card); };
|
|
131
|
-
links.appendChild(assign);
|
|
132
|
-
}
|
|
133
|
-
if (links.dataset.wandSessionsLoaded === taskId) return;
|
|
134
|
-
links.dataset.wandSessionsLoaded = taskId;
|
|
135
|
-
originalFetch("/taskboard/api/wand/sessions?taskId=" + encodeURIComponent(taskId), {headers: currentSessionId ? {"X-Wand-Session-Id": currentSessionId} : {}})
|
|
136
|
-
.then((response) => response.ok ? response.json() : {sessions: []})
|
|
137
|
-
.then((payload) => {
|
|
138
|
-
const sessions = Array.isArray(payload.sessions) ? payload.sessions : [];
|
|
139
|
-
[...links.children].filter((node) => !node.classList.contains("wand-agent-assign")).forEach((node) => node.remove());
|
|
140
|
-
if (!sessions.length) {
|
|
141
|
-
const empty = document.createElement("span"); empty.className = "wand-session-empty"; empty.textContent = currentSessionId ? "尚未绑定 Wand 会话" : "未绑定 Wand 会话"; links.prepend(empty);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
sessions.forEach((session) => {
|
|
145
|
-
const button = document.createElement("button"); button.type = "button"; button.className = "wand-session-link wand-agent-assignment";
|
|
146
|
-
button.textContent = providerLabel(session.provider) + (session.model ? " · " + session.model : "") + " · " + ({off:"关闭",standard:"标准",deep:"深入",max:"最大"}[session.thinkingEffort] || session.thinkingEffort || "关闭");
|
|
147
|
-
button.title = "打开 Wand 会话"; button.onclick = (event) => { event.stopPropagation(); window.parent.postMessage({type:"wand-taskboard-open-session", sessionId: session.id}, location.origin); };
|
|
148
|
-
links.prepend(button);
|
|
149
|
-
});
|
|
150
|
-
}).catch(() => {
|
|
151
|
-
[...links.children].filter((node) => !node.classList.contains("wand-agent-assign")).forEach((node) => node.remove());
|
|
152
|
-
const unavailable = document.createElement("span"); unavailable.className = "wand-session-empty"; unavailable.textContent = "Wand 会话不可用"; links.prepend(unavailable);
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
const scan = () => document.querySelectorAll("[data-task-id]").forEach(setup);
|
|
156
|
-
let readyAnnounced = false;
|
|
157
|
-
const announceReady = (repeat = false) => {
|
|
158
|
-
const root = document.getElementById("root");
|
|
159
|
-
if (!root || !root.childElementCount || window.parent === window || (readyAnnounced && !repeat)) return;
|
|
160
|
-
readyAnnounced = true;
|
|
161
|
-
window.parent.postMessage({type:"wand-taskboard-ready"}, location.origin);
|
|
162
|
-
};
|
|
163
|
-
new MutationObserver(() => { scan(); announceReady(); }).observe(document.documentElement, {childList:true, subtree:true});
|
|
164
|
-
window.addEventListener("load", () => announceReady());
|
|
165
|
-
window.addEventListener("message", (event) => {
|
|
166
|
-
if (event.origin === location.origin && event.source === window.parent && event.data?.type === "wand-taskboard-ready-request") announceReady(true);
|
|
167
|
-
});
|
|
168
|
-
scan();
|
|
169
|
-
})();
|
|
170
|
-
</script>`;
|
|
171
|
-
}
|
|
172
|
-
const TASKBOARD_PROVIDERS = new Set(["claude", "codex", "opencode", "grok", "qoder", "pi"]);
|
|
173
|
-
const TASKBOARD_EFFORTS = new Set(["off", "standard", "deep", "max"]);
|
|
174
|
-
function readJsonBody(request) {
|
|
175
|
-
return new Promise((resolve, reject) => {
|
|
176
|
-
const chunks = [];
|
|
177
|
-
request.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
|
|
178
|
-
request.on("end", () => {
|
|
179
|
-
try {
|
|
180
|
-
resolve(JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}"));
|
|
181
|
-
}
|
|
182
|
-
catch {
|
|
183
|
-
reject(new Error("请求体不是有效 JSON。"));
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
request.on("error", reject);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
function upstreamJson(port, requestPath) {
|
|
190
|
-
return new Promise((resolve, reject) => {
|
|
191
|
-
const request = httpRequest({ hostname: "127.0.0.1", port, path: requestPath, method: "GET" }, (response) => {
|
|
192
|
-
const chunks = [];
|
|
193
|
-
response.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
|
|
194
|
-
response.on("end", () => {
|
|
195
|
-
try {
|
|
196
|
-
const value = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
197
|
-
if ((response.statusCode ?? 500) >= 400)
|
|
198
|
-
reject(new Error(value?.error || "任务面板读取失败。"));
|
|
199
|
-
else
|
|
200
|
-
resolve(value);
|
|
201
|
-
}
|
|
202
|
-
catch {
|
|
203
|
-
reject(new Error("任务面板返回了无效数据。"));
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
request.on("error", reject);
|
|
208
|
-
request.end();
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
function rewriteTaskboardHtml(body) {
|
|
212
|
-
const html = body.toString("utf8");
|
|
213
|
-
const script = taskboardIntegrationScript();
|
|
214
|
-
const marker = html.toLowerCase().lastIndexOf("</head>");
|
|
215
|
-
return Buffer.from(marker >= 0 ? `${html.slice(0, marker)}${script}${html.slice(marker)}` : `${html}${script}`);
|
|
216
|
-
}
|
|
217
|
-
export async function startTaskboardBridge(configDir, storage, sessions, structured, fallbackCwd) {
|
|
218
|
-
const port = await freePort();
|
|
219
|
-
const vendorRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../vendor/codex-taskboard");
|
|
220
|
-
const dataDir = path.join(configDir, "taskboard");
|
|
221
|
-
await mkdir(dataDir, { recursive: true });
|
|
222
|
-
const child = spawn(process.execPath, [path.join(vendorRoot, "server/index.mjs")], {
|
|
223
|
-
cwd: vendorRoot,
|
|
224
|
-
env: {
|
|
225
|
-
...process.env,
|
|
226
|
-
CODEX_TASKBOARD_HOST: "127.0.0.1",
|
|
227
|
-
CODEX_TASKBOARD_PORT: String(port),
|
|
228
|
-
CODEX_TASKBOARD_DATA_DIR: dataDir,
|
|
229
|
-
},
|
|
230
|
-
stdio: "ignore",
|
|
231
|
-
});
|
|
232
|
-
await waitForReady(port, child);
|
|
233
|
-
const handler = async (req, res) => {
|
|
234
|
-
const incoming = new URL(req.originalUrl, "http://127.0.0.1");
|
|
235
|
-
const pathname = incoming.pathname.replace(/^\/taskboard/, "") || "/";
|
|
236
|
-
const query = incoming.search;
|
|
237
|
-
const taskId = typeof incoming.searchParams.get("taskId") === "string" ? incoming.searchParams.get("taskId") ?? "" : "";
|
|
238
|
-
const sessionId = typeof req.headers["x-wand-session-id"] === "string" ? req.headers["x-wand-session-id"] : "";
|
|
239
|
-
if (storage && sessions && structured && pathname === "/api/wand/assign" && req.method === "POST") {
|
|
240
|
-
try {
|
|
241
|
-
const body = await readJsonBody(req);
|
|
242
|
-
if (!body || typeof body !== "object" || Array.isArray(body))
|
|
243
|
-
throw new Error("请求体必须是对象。");
|
|
244
|
-
const input = body;
|
|
245
|
-
const targetTaskId = validId(input.taskId) ? input.taskId : "";
|
|
246
|
-
const provider = typeof input.provider === "string" ? input.provider.trim() : "";
|
|
247
|
-
const model = typeof input.model === "string" ? input.model.trim() : "";
|
|
248
|
-
const thinkingEffort = typeof input.thinkingEffort === "string" ? input.thinkingEffort.trim() : "off";
|
|
249
|
-
if (!targetTaskId || !TASKBOARD_PROVIDERS.has(provider))
|
|
250
|
-
throw new Error("请选择有效的 Agent。");
|
|
251
|
-
if (model.length > 128)
|
|
252
|
-
throw new Error("模型名称过长。");
|
|
253
|
-
if (!TASKBOARD_EFFORTS.has(thinkingEffort))
|
|
254
|
-
throw new Error("思考深度无效。");
|
|
255
|
-
const taskPayload = await upstreamJson(port, `/api/tasks/${encodeURIComponent(targetTaskId)}`);
|
|
256
|
-
const task = taskPayload?.task;
|
|
257
|
-
if (!task || task.source === "jira")
|
|
258
|
-
throw new Error("只能指派本地任务。");
|
|
259
|
-
const projectsPayload = await upstreamJson(port, "/api/projects");
|
|
260
|
-
const project = Array.isArray(projectsPayload?.projects) ? projectsPayload.projects.find((item) => item?.id === task.projectId) : null;
|
|
261
|
-
const current = sessionId ? sessions.get(sessionId) : null;
|
|
262
|
-
const cwd = typeof task.developmentContext?.path === "string" && task.developmentContext.path.trim()
|
|
263
|
-
? task.developmentContext.path.trim()
|
|
264
|
-
: typeof project?.workspacePath === "string" && project.workspacePath.trim()
|
|
265
|
-
? project.workspacePath.trim()
|
|
266
|
-
: current?.cwd || fallbackCwd;
|
|
267
|
-
if (!cwd)
|
|
268
|
-
throw new Error("任务没有可用的工作目录,请先为 Taskboard 项目配置工作目录。");
|
|
269
|
-
const prompt = [task.title, typeof task.description === "string" ? task.description.trim() : ""].filter(Boolean).join("\n\n");
|
|
270
|
-
const session = structured.createSession({
|
|
271
|
-
cwd,
|
|
272
|
-
mode: "agent",
|
|
273
|
-
provider,
|
|
274
|
-
model: model && model !== "default" ? model : undefined,
|
|
275
|
-
thinkingEffort,
|
|
276
|
-
worktreeEnabled: false,
|
|
277
|
-
sessionSource: "automation",
|
|
278
|
-
automationId: `taskboard:${targetTaskId}`,
|
|
279
|
-
});
|
|
280
|
-
storage.bindTaskboardTaskSession(targetTaskId, session.id);
|
|
281
|
-
const completion = structured.sendMessage(session.id, prompt || task.title || "执行此任务");
|
|
282
|
-
completion.catch((error) => console.error(`[Taskboard] Agent dispatch failed for ${targetTaskId}:`, error));
|
|
283
|
-
res.status(202).json({ ok: true, taskId: targetTaskId, session: { id: session.id, provider, model: session.selectedModel, thinkingEffort: session.thinkingEffort, cwd: session.cwd } });
|
|
284
|
-
}
|
|
285
|
-
catch (error) {
|
|
286
|
-
res.status(400).json({ error: error instanceof Error ? error.message : String(error) });
|
|
287
|
-
}
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
if (storage && sessions && pathname === "/api/wand/sessions" && req.method === "GET") {
|
|
291
|
-
const ids = storage.listTaskboardTaskSessions(taskId);
|
|
292
|
-
const result = ids.flatMap((id) => {
|
|
293
|
-
const session = sessions.getLatest(id);
|
|
294
|
-
return session ? [{ id: session.id, provider: session.provider ?? "", sessionKind: session.sessionKind ?? "", title: session.title || session.description || session.command, status: session.status, cwd: session.cwd, model: session.selectedModel || session.structuredState?.model || "", thinkingEffort: session.thinkingEffort || "off" }] : [];
|
|
295
|
-
});
|
|
296
|
-
res.json({ sessions: result });
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
if (storage && sessions && pathname === "/api/wand/bindings" && req.method === "POST") {
|
|
300
|
-
const body = req.body;
|
|
301
|
-
const targetTaskId = validId(body?.taskId) ? body.taskId : "";
|
|
302
|
-
const targetSessionId = validId(body?.sessionId) ? body.sessionId : sessionId;
|
|
303
|
-
if (!targetTaskId || !targetSessionId || !sessions.get(targetSessionId)) {
|
|
304
|
-
res.status(400).json({ error: "任务或会话无效。" });
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
storage.bindTaskboardTaskSession(targetTaskId, targetSessionId);
|
|
308
|
-
res.status(201).json({ ok: true, taskId: targetTaskId, sessionId: targetSessionId });
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
const headers = { ...req.headers };
|
|
312
|
-
delete headers.host;
|
|
313
|
-
delete headers.connection;
|
|
314
|
-
headers["x-forwarded-host"] = req.get("host") ?? undefined;
|
|
315
|
-
const upstream = httpRequest({ hostname: "127.0.0.1", port, path: pathname + query, method: req.method, headers }, (response) => {
|
|
316
|
-
res.status(response.statusCode ?? 502);
|
|
317
|
-
const isHtml = String(response.headers["content-type"] ?? "").includes("text/html");
|
|
318
|
-
const captureTaskMutation = storage && sessions && req.method !== "GET" && req.method !== "HEAD" && pathname.startsWith("/api/tasks");
|
|
319
|
-
if (!isHtml && !captureTaskMutation) {
|
|
320
|
-
for (const [name, value] of Object.entries(response.headers))
|
|
321
|
-
if (value !== undefined && name !== "transfer-encoding" && name !== "connection")
|
|
322
|
-
res.setHeader(name, value);
|
|
323
|
-
response.pipe(res);
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
const chunks = [];
|
|
327
|
-
response.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
|
|
328
|
-
response.on("end", () => {
|
|
329
|
-
let body = Buffer.concat(chunks);
|
|
330
|
-
if (isHtml)
|
|
331
|
-
body = rewriteTaskboardHtml(body);
|
|
332
|
-
if (captureTaskMutation) {
|
|
333
|
-
try {
|
|
334
|
-
const payload = JSON.parse(body.toString("utf8"));
|
|
335
|
-
const createdTaskId = typeof payload.task?.id === "string" ? payload.task.id : "";
|
|
336
|
-
if (sessionId && createdTaskId && sessions.get(sessionId))
|
|
337
|
-
storage.bindTaskboardTaskSession(createdTaskId, sessionId);
|
|
338
|
-
}
|
|
339
|
-
catch { /* preserve the upstream response */ }
|
|
340
|
-
}
|
|
341
|
-
for (const [name, value] of Object.entries(response.headers))
|
|
342
|
-
if (value !== undefined && name !== "transfer-encoding" && name !== "connection" && name !== "content-length")
|
|
343
|
-
res.setHeader(name, value);
|
|
344
|
-
res.setHeader("content-length", body.byteLength);
|
|
345
|
-
res.end(body);
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
upstream.once("error", () => { if (!res.headersSent)
|
|
349
|
-
res.status(502).json({ error: "任务面板服务不可用。" });
|
|
350
|
-
else
|
|
351
|
-
res.destroy(); });
|
|
352
|
-
const contentType = String(req.headers["content-type"] ?? "");
|
|
353
|
-
if (contentType.includes("application/json") && req.body !== undefined) {
|
|
354
|
-
const payload = JSON.stringify(req.body);
|
|
355
|
-
delete headers["content-length"];
|
|
356
|
-
upstream.setHeader("content-length", Buffer.byteLength(payload));
|
|
357
|
-
upstream.end(payload);
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
req.pipe(upstream);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
return {
|
|
364
|
-
handler,
|
|
365
|
-
close: async () => {
|
|
366
|
-
if (!child.killed)
|
|
367
|
-
child.kill("SIGTERM");
|
|
368
|
-
await new Promise((resolve) => { const timer = setTimeout(resolve, 1_000); child.once("exit", () => { clearTimeout(timer); resolve(); }); });
|
|
369
|
-
},
|
|
370
|
-
};
|
|
371
|
-
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|