@morphllm/morphsdk 0.2.184 → 0.2.186
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/{chunk-JZJ75Z47.js → chunk-367YP7VI.js} +8 -3
- package/dist/chunk-367YP7VI.js.map +1 -0
- package/dist/{chunk-DNVCIIMV.js → chunk-5ZEOFXZ5.js} +2 -2
- package/dist/{chunk-DAX3ANOA.js → chunk-63YFGOEU.js} +3 -3
- package/dist/{chunk-CEA3R4J7.js → chunk-6IO6GGUX.js} +3 -3
- package/dist/{chunk-IDMKQWQG.js → chunk-ATAKRJQZ.js} +36 -1
- package/dist/chunk-ATAKRJQZ.js.map +1 -0
- package/dist/{chunk-R3MDQ6II.js → chunk-CDKXTZ2Z.js} +2 -2
- package/dist/{chunk-C3B5MCJI.js → chunk-CXK5T7F2.js} +2 -2
- package/dist/{chunk-2UOKVPIL.js → chunk-GBDBLBED.js} +2 -2
- package/dist/{chunk-RYITZGY6.js → chunk-GJZMU4EB.js} +2 -2
- package/dist/{chunk-TYMBLS7J.js → chunk-GSUBJHVG.js} +2 -2
- package/dist/{chunk-NNC7NUNL.js → chunk-GV2WRFPK.js} +2 -2
- package/dist/{chunk-VGNNHWAE.js → chunk-HRYLFCRA.js} +2 -2
- package/dist/{chunk-NZHRYBXS.js → chunk-HUFM744Z.js} +6 -6
- package/dist/{chunk-MN7K4UPX.js → chunk-J7PGI22Q.js} +2 -2
- package/dist/{chunk-CRX7U4N6.js → chunk-JKL2KXZE.js} +2 -2
- package/dist/{chunk-FZYE6TIU.js → chunk-JUN7CGJS.js} +32 -26
- package/dist/{chunk-FZYE6TIU.js.map → chunk-JUN7CGJS.js.map} +1 -1
- package/dist/{chunk-RPX46ER3.js → chunk-KGGVQIX2.js} +10 -10
- package/dist/{chunk-GG3567UT.js → chunk-KUUHLUAD.js} +2 -2
- package/dist/{chunk-PJDTQSBL.js → chunk-LQZKHPSI.js} +4 -4
- package/dist/{chunk-RSAWA67J.js → chunk-NTHW7HWO.js} +2 -2
- package/dist/{chunk-A77UFLGX.js → chunk-O3NX5HYG.js} +3 -3
- package/dist/{chunk-54OLRNWB.js → chunk-OAVJALMI.js} +2 -2
- package/dist/{chunk-EO64JD3Y.js → chunk-QIBZCGVC.js} +2 -2
- package/dist/{chunk-QXU2RXTD.js → chunk-RFV7IENZ.js} +4 -4
- package/dist/{chunk-VXEP6Q2E.js → chunk-S4FYKLFU.js} +2 -2
- package/dist/{chunk-WKK57U64.js → chunk-SFKMXDHZ.js} +2 -2
- package/dist/{chunk-FGHJS67Z.js → chunk-SVEFNNZZ.js} +2 -2
- package/dist/{chunk-UEBROM7G.js → chunk-SYMPPKBU.js} +6 -4
- package/dist/chunk-SYMPPKBU.js.map +1 -0
- package/dist/chunk-TCCZBGG5.js +46 -0
- package/dist/chunk-TCCZBGG5.js.map +1 -0
- package/dist/{chunk-37BHEELU.js → chunk-TSPEY6CH.js} +2 -2
- package/dist/{chunk-OPNTDMHH.js → chunk-VLZ6PNAD.js} +4 -4
- package/dist/{chunk-LG4ZDMXH.js → chunk-XD43GGXS.js} +2 -2
- package/dist/{chunk-YYZX5TMX.js → chunk-XR2RMRIN.js} +2 -2
- package/dist/{chunk-7ZZH5ZHL.js → chunk-YCPWGE2Y.js} +34 -10
- package/dist/chunk-YCPWGE2Y.js.map +1 -0
- package/dist/{chunk-PHXOP6I6.js → chunk-YGUO3GDG.js} +2 -2
- package/dist/{client-DUvmVWQJ.d.ts → client-BtIoVFEt.d.ts} +3 -0
- package/dist/client.cjs +79 -9
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +3 -1
- package/dist/client.js +32 -31
- package/dist/core/client.cjs +7 -2
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.js +4 -4
- package/dist/core/error.cjs +7 -2
- package/dist/core/error.cjs.map +1 -1
- package/dist/core/error.js +3 -3
- package/dist/core/index.cjs +7 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +4 -4
- package/dist/edge.cjs +7 -2
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +7 -7
- package/dist/git/client.cjs +7 -2
- package/dist/git/client.cjs.map +1 -1
- package/dist/git/client.js +5 -5
- package/dist/git/index.cjs +7 -2
- package/dist/git/index.cjs.map +1 -1
- package/dist/git/index.js +5 -5
- package/dist/index.cjs +81 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +39 -35
- package/dist/modelrouter/core.cjs +7 -2
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +5 -5
- package/dist/modelrouter/index.cjs +7 -2
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +5 -5
- package/dist/subagents/anthropic.cjs +7 -2
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.js +11 -11
- package/dist/subagents/vercel.cjs +7 -2
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.js +11 -11
- package/dist/tools/browser/anthropic.cjs +7 -2
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +7 -7
- package/dist/tools/browser/core.cjs +7 -2
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +6 -6
- package/dist/tools/browser/index.cjs +7 -2
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +9 -9
- package/dist/tools/browser/openai.cjs +7 -2
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +7 -7
- package/dist/tools/browser/profiles/core.cjs +7 -2
- package/dist/tools/browser/profiles/core.cjs.map +1 -1
- package/dist/tools/browser/profiles/core.js +3 -3
- package/dist/tools/browser/profiles/index.cjs +7 -2
- package/dist/tools/browser/profiles/index.cjs.map +1 -1
- package/dist/tools/browser/profiles/index.js +3 -3
- package/dist/tools/browser/vercel.cjs +7 -2
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +7 -7
- package/dist/tools/codebase_search/anthropic.cjs +7 -2
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +6 -6
- package/dist/tools/codebase_search/core.cjs +7 -2
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.js +5 -5
- package/dist/tools/codebase_search/index.cjs +7 -2
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +8 -8
- package/dist/tools/codebase_search/openai.cjs +7 -2
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +6 -6
- package/dist/tools/codebase_search/vercel.cjs +7 -2
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +6 -6
- package/dist/tools/compact/core.cjs +7 -2
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.js +5 -5
- package/dist/tools/compact/index.cjs +7 -2
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.js +6 -6
- package/dist/tools/fastapply/anthropic.cjs +7 -2
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +7 -7
- package/dist/tools/fastapply/apply.cjs +7 -2
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +7 -2
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +6 -6
- package/dist/tools/fastapply/index.cjs +7 -2
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +9 -9
- package/dist/tools/fastapply/openai.cjs +7 -2
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +7 -7
- package/dist/tools/fastapply/vercel.cjs +7 -2
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +7 -7
- package/dist/tools/index.cjs +7 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +9 -9
- package/dist/tools/reflex/core.cjs +38 -9
- package/dist/tools/reflex/core.cjs.map +1 -1
- package/dist/tools/reflex/core.d.ts +8 -2
- package/dist/tools/reflex/core.js +5 -5
- package/dist/tools/reflex/index.cjs +38 -9
- package/dist/tools/reflex/index.cjs.map +1 -1
- package/dist/tools/reflex/index.d.ts +1 -1
- package/dist/tools/reflex/index.js +5 -5
- package/dist/tools/reflex/types.cjs.map +1 -1
- package/dist/tools/reflex/types.d.ts +38 -9
- package/dist/tools/traces/core.cjs +76 -0
- package/dist/tools/traces/core.cjs.map +1 -0
- package/dist/tools/traces/core.d.ts +24 -0
- package/dist/tools/traces/core.js +9 -0
- package/dist/tools/traces/core.js.map +1 -0
- package/dist/tools/traces/index.cjs +76 -0
- package/dist/tools/traces/index.cjs.map +1 -0
- package/dist/tools/traces/index.d.ts +5 -0
- package/dist/tools/traces/index.js +9 -0
- package/dist/tools/traces/index.js.map +1 -0
- package/dist/tools/traces/types.cjs +19 -0
- package/dist/tools/traces/types.cjs.map +1 -0
- package/dist/tools/traces/types.d.ts +56 -0
- package/dist/tools/traces/types.js +1 -0
- package/dist/tools/traces/types.js.map +1 -0
- package/dist/tools/utils/resilience.cjs +7 -2
- package/dist/tools/utils/resilience.cjs.map +1 -1
- package/dist/tools/utils/resilience.js +2 -2
- package/dist/tools/warp_grep/agent/runner.cjs +7 -2
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +3 -3
- package/dist/tools/warp_grep/anthropic.cjs +7 -2
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +11 -11
- package/dist/tools/warp_grep/client.cjs +7 -2
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +10 -10
- package/dist/tools/warp_grep/gemini.cjs +7 -2
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +10 -10
- package/dist/tools/warp_grep/harness.js +6 -6
- package/dist/tools/warp_grep/index.cjs +7 -2
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +15 -15
- package/dist/tools/warp_grep/openai.cjs +7 -2
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +11 -11
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/vercel.cjs +7 -2
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +11 -11
- package/dist/tracing/core.cjs +34 -2
- package/dist/tracing/core.cjs.map +1 -1
- package/dist/tracing/core.d.ts +2 -1
- package/dist/tracing/core.js +2 -2
- package/dist/tracing/index.cjs +42 -4
- package/dist/tracing/index.cjs.map +1 -1
- package/dist/tracing/index.d.ts +34 -0
- package/dist/tracing/index.js +10 -3
- package/dist/tracing/interaction.cjs +30 -0
- package/dist/tracing/interaction.cjs.map +1 -1
- package/dist/tracing/interaction.js +1 -1
- package/dist/tracing/types.cjs.map +1 -1
- package/dist/tracing/types.d.ts +27 -1
- package/dist/version.cjs +7 -2
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -2
- package/dist/chunk-7ZZH5ZHL.js.map +0 -1
- package/dist/chunk-IDMKQWQG.js.map +0 -1
- package/dist/chunk-JZJ75Z47.js.map +0 -1
- package/dist/chunk-UEBROM7G.js.map +0 -1
- /package/dist/{chunk-DNVCIIMV.js.map → chunk-5ZEOFXZ5.js.map} +0 -0
- /package/dist/{chunk-DAX3ANOA.js.map → chunk-63YFGOEU.js.map} +0 -0
- /package/dist/{chunk-CEA3R4J7.js.map → chunk-6IO6GGUX.js.map} +0 -0
- /package/dist/{chunk-R3MDQ6II.js.map → chunk-CDKXTZ2Z.js.map} +0 -0
- /package/dist/{chunk-C3B5MCJI.js.map → chunk-CXK5T7F2.js.map} +0 -0
- /package/dist/{chunk-2UOKVPIL.js.map → chunk-GBDBLBED.js.map} +0 -0
- /package/dist/{chunk-RYITZGY6.js.map → chunk-GJZMU4EB.js.map} +0 -0
- /package/dist/{chunk-TYMBLS7J.js.map → chunk-GSUBJHVG.js.map} +0 -0
- /package/dist/{chunk-NNC7NUNL.js.map → chunk-GV2WRFPK.js.map} +0 -0
- /package/dist/{chunk-VGNNHWAE.js.map → chunk-HRYLFCRA.js.map} +0 -0
- /package/dist/{chunk-NZHRYBXS.js.map → chunk-HUFM744Z.js.map} +0 -0
- /package/dist/{chunk-MN7K4UPX.js.map → chunk-J7PGI22Q.js.map} +0 -0
- /package/dist/{chunk-CRX7U4N6.js.map → chunk-JKL2KXZE.js.map} +0 -0
- /package/dist/{chunk-RPX46ER3.js.map → chunk-KGGVQIX2.js.map} +0 -0
- /package/dist/{chunk-GG3567UT.js.map → chunk-KUUHLUAD.js.map} +0 -0
- /package/dist/{chunk-PJDTQSBL.js.map → chunk-LQZKHPSI.js.map} +0 -0
- /package/dist/{chunk-RSAWA67J.js.map → chunk-NTHW7HWO.js.map} +0 -0
- /package/dist/{chunk-A77UFLGX.js.map → chunk-O3NX5HYG.js.map} +0 -0
- /package/dist/{chunk-54OLRNWB.js.map → chunk-OAVJALMI.js.map} +0 -0
- /package/dist/{chunk-EO64JD3Y.js.map → chunk-QIBZCGVC.js.map} +0 -0
- /package/dist/{chunk-QXU2RXTD.js.map → chunk-RFV7IENZ.js.map} +0 -0
- /package/dist/{chunk-VXEP6Q2E.js.map → chunk-S4FYKLFU.js.map} +0 -0
- /package/dist/{chunk-WKK57U64.js.map → chunk-SFKMXDHZ.js.map} +0 -0
- /package/dist/{chunk-FGHJS67Z.js.map → chunk-SVEFNNZZ.js.map} +0 -0
- /package/dist/{chunk-37BHEELU.js.map → chunk-TSPEY6CH.js.map} +0 -0
- /package/dist/{chunk-OPNTDMHH.js.map → chunk-VLZ6PNAD.js.map} +0 -0
- /package/dist/{chunk-LG4ZDMXH.js.map → chunk-XD43GGXS.js.map} +0 -0
- /package/dist/{chunk-YYZX5TMX.js.map → chunk-XR2RMRIN.js.map} +0 -0
- /package/dist/{chunk-PHXOP6I6.js.map → chunk-YGUO3GDG.js.map} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
APIResource
|
|
3
|
+
} from "./chunk-LKFZBBTD.js";
|
|
4
|
+
|
|
5
|
+
// tools/traces/core.ts
|
|
6
|
+
var TracesClient = class extends APIResource {
|
|
7
|
+
/** List traced turns, newest first. Filter by `convoId`; page with `limit`/`offset`. */
|
|
8
|
+
async list(input = {}) {
|
|
9
|
+
const raw = await this._client.get("/v1/reflex/traces", {
|
|
10
|
+
query: { convo_id: input.convoId, limit: input.limit, offset: input.offset }
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
data: (raw.data ?? []).map(toTrace),
|
|
14
|
+
hasMore: Boolean(raw.has_more),
|
|
15
|
+
offset: raw.offset ?? 0
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function toReflexResult(raw) {
|
|
20
|
+
return {
|
|
21
|
+
model: raw.model,
|
|
22
|
+
transform: raw.transform,
|
|
23
|
+
label: raw.label ?? null,
|
|
24
|
+
score: raw.score,
|
|
25
|
+
selected: raw.selected ?? [],
|
|
26
|
+
status: raw.status,
|
|
27
|
+
transformVersion: raw.transform_version
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function toTrace(raw) {
|
|
31
|
+
return {
|
|
32
|
+
convoId: raw.convo_id,
|
|
33
|
+
eventId: raw.event_id,
|
|
34
|
+
spanKind: raw.span_kind,
|
|
35
|
+
model: raw.model,
|
|
36
|
+
inputText: raw.input_text,
|
|
37
|
+
outputText: raw.output_text,
|
|
38
|
+
startTime: raw.start_time,
|
|
39
|
+
reflexResults: (raw.reflex_results ?? []).map(toReflexResult)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
TracesClient
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=chunk-TCCZBGG5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/traces/core.ts"],"sourcesContent":["/**\n * Traces: read back the agent turns you shipped with `morphTracing()`, each\n * carrying the Reflex labels that ran on it.\n *\n * const morph = new MorphClient({ apiKey });\n * const page = await morph.traces.list({ convoId: 'c1' });\n * for (const turn of page.data) {\n * console.log(turn.inputText, turn.reflexResults);\n * }\n *\n * Reads `GET /v1/reflex/traces`. All HTTP goes through the shared `MorphAPIClient`.\n */\nimport { APIResource } from '../../core/resource.js';\nimport type { ListTracesInput, Trace, TraceList, TraceReflexResult } from './types.js';\n\nexport class TracesClient extends APIResource {\n /** List traced turns, newest first. Filter by `convoId`; page with `limit`/`offset`. */\n async list(input: ListTracesInput = {}): Promise<TraceList> {\n const raw = await this._client.get<RawTraceList>('/v1/reflex/traces', {\n query: { convo_id: input.convoId, limit: input.limit, offset: input.offset },\n });\n return {\n data: (raw.data ?? []).map(toTrace),\n hasMore: Boolean(raw.has_more),\n offset: raw.offset ?? 0,\n };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Mapping (snake_case -> camelCase)\n// ---------------------------------------------------------------------------\n\ninterface RawReflexResult {\n model: string;\n transform: string;\n label: string | null;\n score: number;\n selected?: string[];\n status: string;\n transform_version: number;\n}\ninterface RawTrace {\n convo_id: string;\n event_id: string;\n span_kind: string;\n model: string;\n input_text: string;\n output_text: string;\n start_time: string;\n reflex_results?: RawReflexResult[];\n}\ninterface RawTraceList {\n data?: RawTrace[];\n has_more?: boolean;\n offset?: number;\n}\n\nfunction toReflexResult(raw: RawReflexResult): TraceReflexResult {\n return {\n model: raw.model,\n transform: raw.transform,\n label: raw.label ?? null,\n score: raw.score,\n selected: raw.selected ?? [],\n status: raw.status,\n transformVersion: raw.transform_version,\n };\n}\n\nfunction toTrace(raw: RawTrace): Trace {\n return {\n convoId: raw.convo_id,\n eventId: raw.event_id,\n spanKind: raw.span_kind,\n model: raw.model,\n inputText: raw.input_text,\n outputText: raw.output_text,\n startTime: raw.start_time,\n reflexResults: (raw.reflex_results ?? []).map(toReflexResult),\n };\n}\n"],"mappings":";;;;;AAeO,IAAM,eAAN,cAA2B,YAAY;AAAA;AAAA,EAE5C,MAAM,KAAK,QAAyB,CAAC,GAAuB;AAC1D,UAAM,MAAM,MAAM,KAAK,QAAQ,IAAkB,qBAAqB;AAAA,MACpE,OAAO,EAAE,UAAU,MAAM,SAAS,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO;AAAA,IAC7E,CAAC;AACD,WAAO;AAAA,MACL,OAAO,IAAI,QAAQ,CAAC,GAAG,IAAI,OAAO;AAAA,MAClC,SAAS,QAAQ,IAAI,QAAQ;AAAA,MAC7B,QAAQ,IAAI,UAAU;AAAA,IACxB;AAAA,EACF;AACF;AA+BA,SAAS,eAAe,KAAyC;AAC/D,SAAO;AAAA,IACL,OAAO,IAAI;AAAA,IACX,WAAW,IAAI;AAAA,IACf,OAAO,IAAI,SAAS;AAAA,IACpB,OAAO,IAAI;AAAA,IACX,UAAU,IAAI,YAAY,CAAC;AAAA,IAC3B,QAAQ,IAAI;AAAA,IACZ,kBAAkB,IAAI;AAAA,EACxB;AACF;AAEA,SAAS,QAAQ,KAAsB;AACrC,SAAO;AAAA,IACL,SAAS,IAAI;AAAA,IACb,SAAS,IAAI;AAAA,IACb,UAAU,IAAI;AAAA,IACd,OAAO,IAAI;AAAA,IACX,WAAW,IAAI;AAAA,IACf,YAAY,IAAI;AAAA,IAChB,WAAW,IAAI;AAAA,IACf,gBAAgB,IAAI,kBAAkB,CAAC,GAAG,IAAI,cAAc;AAAA,EAC9D;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphAPIClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RFV7IENZ.js";
|
|
4
4
|
import {
|
|
5
5
|
APIResource
|
|
6
6
|
} from "./chunk-LKFZBBTD.js";
|
|
@@ -558,4 +558,4 @@ var MorphGit = class extends APIResource {
|
|
|
558
558
|
export {
|
|
559
559
|
MorphGit
|
|
560
560
|
};
|
|
561
|
-
//# sourceMappingURL=chunk-
|
|
561
|
+
//# sourceMappingURL=chunk-TSPEY6CH.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readAllLines
|
|
3
|
-
} from "./chunk-G2RSY56Q.js";
|
|
4
1
|
import {
|
|
5
2
|
fixPathRepetition,
|
|
6
3
|
isSymlink,
|
|
@@ -11,6 +8,9 @@ import {
|
|
|
11
8
|
import {
|
|
12
9
|
runRipgrep
|
|
13
10
|
} from "./chunk-TPP2UGQP.js";
|
|
11
|
+
import {
|
|
12
|
+
readAllLines
|
|
13
|
+
} from "./chunk-G2RSY56Q.js";
|
|
14
14
|
import {
|
|
15
15
|
AGENT_CONFIG,
|
|
16
16
|
DEFAULT_EXCLUDES
|
|
@@ -341,4 +341,4 @@ Details: ${res.stderr}` : ""}`
|
|
|
341
341
|
export {
|
|
342
342
|
LocalRipgrepProvider
|
|
343
343
|
};
|
|
344
|
-
//# sourceMappingURL=chunk-
|
|
344
|
+
//# sourceMappingURL=chunk-VLZ6PNAD.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
executeToolCall,
|
|
15
15
|
formatGitHubReadFileResult,
|
|
16
16
|
formatResult
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KGGVQIX2.js";
|
|
18
18
|
|
|
19
19
|
// tools/warp_grep/openai.ts
|
|
20
20
|
var TOOL_PARAMETERS = {
|
|
@@ -104,4 +104,4 @@ export {
|
|
|
104
104
|
createGitHubReadFileTool,
|
|
105
105
|
openai_default
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-XD43GGXS.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-367YP7VI.js";
|
|
4
4
|
|
|
5
5
|
// tools/utils/resilience.ts
|
|
6
6
|
var DEFAULT_RETRY_CONFIG = {
|
|
@@ -91,4 +91,4 @@ export {
|
|
|
91
91
|
withTimeout,
|
|
92
92
|
MorphError
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-XR2RMRIN.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphAPIClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RFV7IENZ.js";
|
|
4
4
|
import {
|
|
5
5
|
MorphError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XR2RMRIN.js";
|
|
7
7
|
import {
|
|
8
8
|
APIResource
|
|
9
9
|
} from "./chunk-LKFZBBTD.js";
|
|
@@ -27,14 +27,37 @@ var ReflexClient = class extends APIResource {
|
|
|
27
27
|
super(resolveClient(clientOrConfig));
|
|
28
28
|
this.jobs = new ReflexJobsResource(this._client);
|
|
29
29
|
}
|
|
30
|
-
/** Classify text against
|
|
30
|
+
/** Classify text against one trained model. The model must be `succeeded`. */
|
|
31
31
|
async predict(input) {
|
|
32
32
|
const completionId = input.completionId ?? crypto.randomUUID();
|
|
33
33
|
const raw = await this._client.post("/v1/reflex/predict", {
|
|
34
34
|
body: { model: input.model, text: input.text },
|
|
35
35
|
headers: { "X-Completion-Id": completionId }
|
|
36
36
|
});
|
|
37
|
-
return
|
|
37
|
+
return {
|
|
38
|
+
...toClassification(raw),
|
|
39
|
+
inferenceTimeMs: raw.inference_time_ms,
|
|
40
|
+
prefillTokens: raw.prefill_tokens ?? 0,
|
|
41
|
+
completionId
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Classify text against several models in one request. They share a single
|
|
46
|
+
* prefill, so the input is tokenized once — cheaper and faster than a call per
|
|
47
|
+
* model. Each model returns its own prediction (or an `error` if it failed).
|
|
48
|
+
*/
|
|
49
|
+
async predictMany(input) {
|
|
50
|
+
const completionId = input.completionId ?? crypto.randomUUID();
|
|
51
|
+
const raw = await this._client.post("/v1/reflex/predict", {
|
|
52
|
+
body: { models: input.models, text: input.text },
|
|
53
|
+
headers: { "X-Completion-Id": completionId }
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
predictions: (raw.predictions ?? []).map(toPrediction),
|
|
57
|
+
inferenceTimeMs: raw.inference_time_ms,
|
|
58
|
+
prefillTokens: raw.prefill_tokens ?? 0,
|
|
59
|
+
completionId
|
|
60
|
+
};
|
|
38
61
|
}
|
|
39
62
|
};
|
|
40
63
|
var ReflexJobsResource = class extends APIResource {
|
|
@@ -133,7 +156,7 @@ function toReflexJob(raw) {
|
|
|
133
156
|
suffix: raw.suffix ?? null
|
|
134
157
|
};
|
|
135
158
|
}
|
|
136
|
-
function
|
|
159
|
+
function toClassification(raw) {
|
|
137
160
|
const classes = (raw.classes ?? []).map((c) => ({
|
|
138
161
|
classId: c.class_id,
|
|
139
162
|
label: c.label,
|
|
@@ -151,12 +174,13 @@ function toPredictResult(raw, completionId) {
|
|
|
151
174
|
classes,
|
|
152
175
|
selected: selectedClasses.map((c) => c.label),
|
|
153
176
|
label: top ? top.label : null,
|
|
154
|
-
confidence: top ? top.score : null
|
|
155
|
-
allScores: classes.map((c) => c.score),
|
|
156
|
-
inferenceTimeMs: raw.inference_time_ms,
|
|
157
|
-
completionId
|
|
177
|
+
confidence: top ? top.score : null
|
|
158
178
|
};
|
|
159
179
|
}
|
|
180
|
+
function toPrediction(raw) {
|
|
181
|
+
const error = raw.error ? { message: typeof raw.error === "string" ? raw.error : raw.error.message } : null;
|
|
182
|
+
return { ...toClassification(raw), error };
|
|
183
|
+
}
|
|
160
184
|
function toReflexEvent(raw) {
|
|
161
185
|
return {
|
|
162
186
|
id: raw.id,
|
|
@@ -175,4 +199,4 @@ export {
|
|
|
175
199
|
ReflexClient,
|
|
176
200
|
ReflexJobsResource
|
|
177
201
|
};
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
202
|
+
//# sourceMappingURL=chunk-YCPWGE2Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/reflex/core.ts"],"sourcesContent":["/**\n * Reflex: train and serve small text classifiers.\n *\n * const morph = new MorphClient({ apiKey });\n * const job = await morph.reflex.jobs.create({ trainingData: rows, suffix: 'support' });\n * const ready = await morph.reflex.jobs.waitForReady(job.id);\n * const out = await morph.reflex.predict({ model: ready.fineTunedModel!, text: 'refund please' });\n *\n * Mirrors the OpenAI fine-tuning shape (`reflex.jobs.create/retrieve/list/cancel/delete`)\n * plus `reflex.predict`. All HTTP goes through the shared `MorphAPIClient` transport.\n */\nimport { MorphAPIClient } from '../../core/client.js';\nimport { APIResource } from '../../core/resource.js';\nimport { MorphError } from '../utils/resilience.js';\nimport type {\n CreateReflexJobInput,\n DeletedReflexJob,\n ListReflexJobsInput,\n ReflexClassification,\n ReflexConfig,\n ReflexEvent,\n ReflexJob,\n ReflexJobList,\n ReflexPrediction,\n ReflexPredictClass,\n ReflexPredictInput,\n ReflexPredictManyInput,\n ReflexPredictManyResult,\n ReflexPredictResult,\n} from './types.js';\n\nconst BASE_MODEL = 'morph-reflex-v1';\n\n/** Build a transport from either a shared client or a standalone `ReflexConfig`. */\nfunction resolveClient(clientOrConfig: MorphAPIClient | ReflexConfig): MorphAPIClient {\n if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;\n return new MorphAPIClient({\n apiKey: clientOrConfig.apiKey,\n baseURL: clientOrConfig.baseUrl,\n timeout: clientOrConfig.timeout,\n retryConfig: clientOrConfig.retryConfig,\n debug: clientOrConfig.debug,\n });\n}\n\n/**\n * @deprecated Prefer the unified `MorphClient` (`new MorphClient({ apiKey }).reflex`).\n * Standalone clients remain only for backwards compatibility and may be removed in a future\n * major version — do not use them in new code.\n */\nexport class ReflexClient extends APIResource {\n /** Train, retrieve, and manage classifier jobs. */\n public readonly jobs: ReflexJobsResource;\n\n constructor(clientOrConfig: MorphAPIClient | ReflexConfig = {}) {\n super(resolveClient(clientOrConfig));\n this.jobs = new ReflexJobsResource(this._client);\n }\n\n /** Classify text against one trained model. The model must be `succeeded`. */\n async predict(input: ReflexPredictInput): Promise<ReflexPredictResult> {\n const completionId = input.completionId ?? crypto.randomUUID();\n const raw = await this._client.post<RawPredict>('/v1/reflex/predict', {\n body: { model: input.model, text: input.text },\n headers: { 'X-Completion-Id': completionId },\n });\n return {\n ...toClassification(raw),\n inferenceTimeMs: raw.inference_time_ms,\n prefillTokens: raw.prefill_tokens ?? 0,\n completionId,\n };\n }\n\n /**\n * Classify text against several models in one request. They share a single\n * prefill, so the input is tokenized once — cheaper and faster than a call per\n * model. Each model returns its own prediction (or an `error` if it failed).\n */\n async predictMany(input: ReflexPredictManyInput): Promise<ReflexPredictManyResult> {\n const completionId = input.completionId ?? crypto.randomUUID();\n const raw = await this._client.post<RawPredictMany>('/v1/reflex/predict', {\n body: { models: input.models, text: input.text },\n headers: { 'X-Completion-Id': completionId },\n });\n return {\n predictions: (raw.predictions ?? []).map(toPrediction),\n inferenceTimeMs: raw.inference_time_ms,\n prefillTokens: raw.prefill_tokens ?? 0,\n completionId,\n };\n }\n}\n\nexport class ReflexJobsResource extends APIResource {\n /** Start a training job from labeled data, a description, or unlabeled text. */\n async create(input: CreateReflexJobInput): Promise<ReflexJob> {\n return toReflexJob(await this._client.post<RawJob>('/v1/fine_tuning/jobs', { body: createBody(input) }));\n }\n\n /** Fetch a job by id. */\n async retrieve(id: string): Promise<ReflexJob> {\n return toReflexJob(await this._client.get<RawJob>(`/v1/fine_tuning/jobs/${encodeURIComponent(id)}`));\n }\n\n /** List the caller's jobs, newest first. */\n async list(input: ListReflexJobsInput = {}): Promise<ReflexJobList> {\n const raw = await this._client.get<RawJobList>('/v1/fine_tuning/jobs', {\n query: { limit: input.limit, after: input.after },\n });\n return { data: (raw.data ?? []).map(toReflexJob), hasMore: Boolean(raw.has_more) };\n }\n\n /** Stop a queued or running job. */\n async cancel(id: string): Promise<ReflexJob> {\n return toReflexJob(await this._client.post<RawJob>(`/v1/fine_tuning/jobs/${encodeURIComponent(id)}/cancel`));\n }\n\n /** Delete a job and its trained model. */\n async delete(id: string): Promise<DeletedReflexJob> {\n const raw = await this._client.delete<{ id: string; deleted?: boolean }>(\n `/v1/fine_tuning/jobs/${encodeURIComponent(id)}`,\n );\n return { id: raw.id, deleted: Boolean(raw.deleted) };\n }\n\n /** The training loss curve as events, plus a terminal event. */\n async events(id: string): Promise<ReflexEvent[]> {\n const raw = await this._client.get<{ data?: RawEvent[] }>(\n `/v1/fine_tuning/jobs/${encodeURIComponent(id)}/events`,\n );\n return (raw.data ?? []).map(toReflexEvent);\n }\n\n /**\n * Poll until the job reaches a terminal status and return it on success.\n * Throws a `MorphError` if it fails, is cancelled, or exceeds `timeoutMs`.\n */\n async waitForReady(id: string, opts: { pollMs?: number; timeoutMs?: number } = {}): Promise<ReflexJob> {\n const pollMs = opts.pollMs ?? 3_000;\n const deadline = Date.now() + (opts.timeoutMs ?? 15 * 60_000);\n\n for (;;) {\n const job = await this.retrieve(id);\n if (job.status === 'succeeded') return job;\n if (job.status === 'failed' || job.status === 'cancelled') {\n throw new MorphError(job.error?.message ?? `Reflex job ${job.status}`, `reflex_job_${job.status}`);\n }\n if (Date.now() >= deadline) {\n throw new MorphError(`Reflex job ${id} did not finish in time`, 'reflex_timeout');\n }\n await sleep(pollMs);\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Mapping (camelCase <-> snake_case) and helpers\n// ---------------------------------------------------------------------------\n\ninterface RawJob {\n id: string;\n model: string;\n created_at: number;\n finished_at: number | null;\n fine_tuned_model: string | null;\n status: ReflexJob['status'];\n labels?: string[];\n trained_examples?: number;\n result?: { accuracy: number | null; f1_score: number | null } | null;\n error?: { message: string } | null;\n suffix?: string | null;\n}\ninterface RawJobList {\n data?: RawJob[];\n has_more?: boolean;\n}\ninterface RawPredictClass {\n class_id: number;\n label: string;\n score: number;\n selected: boolean;\n}\ninterface RawPredict {\n model: string;\n mode?: string;\n classes?: RawPredictClass[];\n inference_time_ms: number;\n prefill_tokens?: number;\n}\ninterface RawPredictionEntry {\n model: string;\n mode?: string;\n classes?: RawPredictClass[];\n error?: { message: string } | string;\n}\ninterface RawPredictMany {\n predictions?: RawPredictionEntry[];\n inference_time_ms: number;\n prefill_tokens?: number;\n}\ninterface RawEvent {\n id: string;\n created_at: number;\n level: ReflexEvent['level'];\n message: string;\n type: ReflexEvent['type'];\n data?: { epoch?: number; step?: number; train_loss?: number };\n}\n\nfunction createBody(input: CreateReflexJobInput): Record<string, unknown> {\n const base: Record<string, unknown> = { model: BASE_MODEL };\n if (input.suffix) base.suffix = input.suffix;\n\n if ('trainingData' in input) {\n if (input.labels) base.labels = input.labels;\n return { ...base, training_data: input.trainingData };\n }\n if ('generate' in input) {\n return {\n ...base,\n labels: input.labels,\n generate: {\n description: input.generate.description,\n ...(input.generate.examplesPerLabel != null ? { examples_per_label: input.generate.examplesPerLabel } : {}),\n },\n };\n }\n return {\n ...base,\n labels: input.labels,\n label_data: {\n texts: input.labelData.texts,\n ...(input.labelData.description ? { description: input.labelData.description } : {}),\n },\n };\n}\n\nfunction toReflexJob(raw: RawJob): ReflexJob {\n return {\n id: raw.id,\n object: 'fine_tuning.job',\n model: raw.model,\n createdAt: raw.created_at,\n finishedAt: raw.finished_at ?? null,\n fineTunedModel: raw.fine_tuned_model ?? null,\n status: raw.status,\n labels: raw.labels ?? [],\n trainedExamples: raw.trained_examples ?? 0,\n result: raw.result ? { accuracy: raw.result.accuracy ?? null, f1Score: raw.result.f1_score ?? null } : null,\n error: raw.error ? { message: raw.error.message } : null,\n suffix: raw.suffix ?? null,\n };\n}\n\n/** Map a raw classification envelope (`{ model, mode, classes }`) to the shared shape. */\nfunction toClassification(raw: { model: string; mode?: string; classes?: RawPredictClass[] }): ReflexClassification {\n const classes: ReflexPredictClass[] = (raw.classes ?? []).map(c => ({\n classId: c.class_id,\n label: c.label,\n score: c.score,\n selected: c.selected,\n }));\n const selectedClasses = classes.filter(c => c.selected);\n // Top selected class by score derives label/confidence.\n const top = selectedClasses.reduce<ReflexPredictClass | null>(\n (best, c) => (best === null || c.score > best.score ? c : best),\n null,\n );\n return {\n model: raw.model,\n mode: raw.mode === 'multi_label' ? 'multi_label' : 'single_label',\n classes,\n selected: selectedClasses.map(c => c.label),\n label: top ? top.label : null,\n confidence: top ? top.score : null,\n };\n}\n\n/** Map one `predictMany` entry: a classification, or an `error` if that model failed. */\nfunction toPrediction(raw: RawPredictionEntry): ReflexPrediction {\n const error = raw.error\n ? { message: typeof raw.error === 'string' ? raw.error : raw.error.message }\n : null;\n return { ...toClassification(raw), error };\n}\n\nfunction toReflexEvent(raw: RawEvent): ReflexEvent {\n return {\n id: raw.id,\n createdAt: raw.created_at,\n level: raw.level,\n message: raw.message,\n type: raw.type,\n data: { epoch: raw.data?.epoch ?? 0, step: raw.data?.step ?? 0, trainLoss: raw.data?.train_loss ?? 0 },\n };\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n"],"mappings":";;;;;;;;;;;AA+BA,IAAM,aAAa;AAGnB,SAAS,cAAc,gBAA+D;AACpF,MAAI,0BAA0B,eAAgB,QAAO;AACrD,SAAO,IAAI,eAAe;AAAA,IACxB,QAAQ,eAAe;AAAA,IACvB,SAAS,eAAe;AAAA,IACxB,SAAS,eAAe;AAAA,IACxB,aAAa,eAAe;AAAA,IAC5B,OAAO,eAAe;AAAA,EACxB,CAAC;AACH;AAOO,IAAM,eAAN,cAA2B,YAAY;AAAA;AAAA,EAE5B;AAAA,EAEhB,YAAY,iBAAgD,CAAC,GAAG;AAC9D,UAAM,cAAc,cAAc,CAAC;AACnC,SAAK,OAAO,IAAI,mBAAmB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
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-F3NCFNUX.js";
|
|
4
4
|
import {
|
|
5
5
|
SDK_VERSION
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-367YP7VI.js";
|
|
7
7
|
|
|
8
8
|
// tools/fastapply/apply.ts
|
|
9
9
|
import { createTwoFilesPatch } from "diff";
|
|
@@ -145,4 +145,4 @@ export {
|
|
|
145
145
|
callMorphAPI,
|
|
146
146
|
applyEdit
|
|
147
147
|
};
|
|
148
|
-
//# sourceMappingURL=chunk-
|
|
148
|
+
//# sourceMappingURL=chunk-YGUO3GDG.js.map
|
|
@@ -8,6 +8,7 @@ import { APIResource } from './core/resource.js';
|
|
|
8
8
|
import { MorphGit } from './git/client.js';
|
|
9
9
|
import { CompactClient } from './tools/compact/core.js';
|
|
10
10
|
import { ReflexClient } from './tools/reflex/core.js';
|
|
11
|
+
import { TracesClient } from './tools/traces/core.js';
|
|
11
12
|
import { OpenAIRouter, AnthropicRouter, GeminiRouter, RawRouter, RouterClassifier } from './modelrouter/core.js';
|
|
12
13
|
import { EditFileConfig, EditFileInput, EditFileResult, EditChanges } from './tools/fastapply/types.js';
|
|
13
14
|
import { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './tools/codebase_search/types.js';
|
|
@@ -1001,6 +1002,8 @@ declare class MorphClient extends MorphAPIClient {
|
|
|
1001
1002
|
compact: CompactClient['compact'];
|
|
1002
1003
|
/** Reflex: train and serve small text classifiers */
|
|
1003
1004
|
reflex: ReflexClient;
|
|
1005
|
+
/** Traces: read back turns shipped with `morphTracing()`, with their Reflex labels */
|
|
1006
|
+
traces: TracesClient;
|
|
1004
1007
|
/**
|
|
1005
1008
|
* Create a new Morph SDK client
|
|
1006
1009
|
*
|
package/dist/client.cjs
CHANGED
|
@@ -36,7 +36,7 @@ var init_package = __esm({
|
|
|
36
36
|
"package.json"() {
|
|
37
37
|
package_default = {
|
|
38
38
|
name: "@morphllm/morphsdk",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.186",
|
|
40
40
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
41
41
|
type: "module",
|
|
42
42
|
main: "./dist/index.cjs",
|
|
@@ -188,6 +188,11 @@ var init_package = __esm({
|
|
|
188
188
|
import: "./dist/tools/reflex/index.js",
|
|
189
189
|
require: "./dist/tools/reflex/index.cjs"
|
|
190
190
|
},
|
|
191
|
+
"./tools/traces": {
|
|
192
|
+
types: "./dist/tools/traces/index.d.ts",
|
|
193
|
+
import: "./dist/tools/traces/index.js",
|
|
194
|
+
require: "./dist/tools/traces/index.cjs"
|
|
195
|
+
},
|
|
191
196
|
"./subagents": {
|
|
192
197
|
types: "./dist/subagents/index.d.ts",
|
|
193
198
|
import: "./dist/subagents/index.js",
|
|
@@ -213,7 +218,7 @@ var init_package = __esm({
|
|
|
213
218
|
"!dist/**/*.test.*"
|
|
214
219
|
],
|
|
215
220
|
scripts: {
|
|
216
|
-
build: "tsup version.ts index.ts edge.ts client.ts core/index.ts core/client.ts core/resource.ts core/error.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/reflex/index.ts tools/reflex/core.ts tools/reflex/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts tracing/index.ts tracing/core.ts tracing/interaction.ts tracing/otel.ts tracing/types.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
|
|
221
|
+
build: "tsup version.ts index.ts edge.ts client.ts core/index.ts core/client.ts core/resource.ts core/error.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/reflex/index.ts tools/reflex/core.ts tools/reflex/types.ts tools/traces/index.ts tools/traces/core.ts tools/traces/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts tracing/index.ts tracing/core.ts tracing/interaction.ts tracing/otel.ts tracing/types.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
|
|
217
222
|
prepare: "npm run build",
|
|
218
223
|
typecheck: "tsc --noEmit",
|
|
219
224
|
lint: "eslint .",
|
|
@@ -5042,14 +5047,37 @@ var ReflexClient = class extends APIResource {
|
|
|
5042
5047
|
super(resolveClient2(clientOrConfig));
|
|
5043
5048
|
this.jobs = new ReflexJobsResource(this._client);
|
|
5044
5049
|
}
|
|
5045
|
-
/** Classify text against
|
|
5050
|
+
/** Classify text against one trained model. The model must be `succeeded`. */
|
|
5046
5051
|
async predict(input) {
|
|
5047
5052
|
const completionId = input.completionId ?? crypto.randomUUID();
|
|
5048
5053
|
const raw = await this._client.post("/v1/reflex/predict", {
|
|
5049
5054
|
body: { model: input.model, text: input.text },
|
|
5050
5055
|
headers: { "X-Completion-Id": completionId }
|
|
5051
5056
|
});
|
|
5052
|
-
return
|
|
5057
|
+
return {
|
|
5058
|
+
...toClassification(raw),
|
|
5059
|
+
inferenceTimeMs: raw.inference_time_ms,
|
|
5060
|
+
prefillTokens: raw.prefill_tokens ?? 0,
|
|
5061
|
+
completionId
|
|
5062
|
+
};
|
|
5063
|
+
}
|
|
5064
|
+
/**
|
|
5065
|
+
* Classify text against several models in one request. They share a single
|
|
5066
|
+
* prefill, so the input is tokenized once — cheaper and faster than a call per
|
|
5067
|
+
* model. Each model returns its own prediction (or an `error` if it failed).
|
|
5068
|
+
*/
|
|
5069
|
+
async predictMany(input) {
|
|
5070
|
+
const completionId = input.completionId ?? crypto.randomUUID();
|
|
5071
|
+
const raw = await this._client.post("/v1/reflex/predict", {
|
|
5072
|
+
body: { models: input.models, text: input.text },
|
|
5073
|
+
headers: { "X-Completion-Id": completionId }
|
|
5074
|
+
});
|
|
5075
|
+
return {
|
|
5076
|
+
predictions: (raw.predictions ?? []).map(toPrediction),
|
|
5077
|
+
inferenceTimeMs: raw.inference_time_ms,
|
|
5078
|
+
prefillTokens: raw.prefill_tokens ?? 0,
|
|
5079
|
+
completionId
|
|
5080
|
+
};
|
|
5053
5081
|
}
|
|
5054
5082
|
};
|
|
5055
5083
|
var ReflexJobsResource = class extends APIResource {
|
|
@@ -5148,7 +5176,7 @@ function toReflexJob(raw) {
|
|
|
5148
5176
|
suffix: raw.suffix ?? null
|
|
5149
5177
|
};
|
|
5150
5178
|
}
|
|
5151
|
-
function
|
|
5179
|
+
function toClassification(raw) {
|
|
5152
5180
|
const classes = (raw.classes ?? []).map((c) => ({
|
|
5153
5181
|
classId: c.class_id,
|
|
5154
5182
|
label: c.label,
|
|
@@ -5166,12 +5194,13 @@ function toPredictResult(raw, completionId) {
|
|
|
5166
5194
|
classes,
|
|
5167
5195
|
selected: selectedClasses.map((c) => c.label),
|
|
5168
5196
|
label: top ? top.label : null,
|
|
5169
|
-
confidence: top ? top.score : null
|
|
5170
|
-
allScores: classes.map((c) => c.score),
|
|
5171
|
-
inferenceTimeMs: raw.inference_time_ms,
|
|
5172
|
-
completionId
|
|
5197
|
+
confidence: top ? top.score : null
|
|
5173
5198
|
};
|
|
5174
5199
|
}
|
|
5200
|
+
function toPrediction(raw) {
|
|
5201
|
+
const error = raw.error ? { message: typeof raw.error === "string" ? raw.error : raw.error.message } : null;
|
|
5202
|
+
return { ...toClassification(raw), error };
|
|
5203
|
+
}
|
|
5175
5204
|
function toReflexEvent(raw) {
|
|
5176
5205
|
return {
|
|
5177
5206
|
id: raw.id,
|
|
@@ -5186,6 +5215,44 @@ function sleep2(ms) {
|
|
|
5186
5215
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
5187
5216
|
}
|
|
5188
5217
|
|
|
5218
|
+
// tools/traces/core.ts
|
|
5219
|
+
var TracesClient = class extends APIResource {
|
|
5220
|
+
/** List traced turns, newest first. Filter by `convoId`; page with `limit`/`offset`. */
|
|
5221
|
+
async list(input = {}) {
|
|
5222
|
+
const raw = await this._client.get("/v1/reflex/traces", {
|
|
5223
|
+
query: { convo_id: input.convoId, limit: input.limit, offset: input.offset }
|
|
5224
|
+
});
|
|
5225
|
+
return {
|
|
5226
|
+
data: (raw.data ?? []).map(toTrace),
|
|
5227
|
+
hasMore: Boolean(raw.has_more),
|
|
5228
|
+
offset: raw.offset ?? 0
|
|
5229
|
+
};
|
|
5230
|
+
}
|
|
5231
|
+
};
|
|
5232
|
+
function toReflexResult(raw) {
|
|
5233
|
+
return {
|
|
5234
|
+
model: raw.model,
|
|
5235
|
+
transform: raw.transform,
|
|
5236
|
+
label: raw.label ?? null,
|
|
5237
|
+
score: raw.score,
|
|
5238
|
+
selected: raw.selected ?? [],
|
|
5239
|
+
status: raw.status,
|
|
5240
|
+
transformVersion: raw.transform_version
|
|
5241
|
+
};
|
|
5242
|
+
}
|
|
5243
|
+
function toTrace(raw) {
|
|
5244
|
+
return {
|
|
5245
|
+
convoId: raw.convo_id,
|
|
5246
|
+
eventId: raw.event_id,
|
|
5247
|
+
spanKind: raw.span_kind,
|
|
5248
|
+
model: raw.model,
|
|
5249
|
+
inputText: raw.input_text,
|
|
5250
|
+
outputText: raw.output_text,
|
|
5251
|
+
startTime: raw.start_time,
|
|
5252
|
+
reflexResults: (raw.reflex_results ?? []).map(toReflexResult)
|
|
5253
|
+
};
|
|
5254
|
+
}
|
|
5255
|
+
|
|
5189
5256
|
// modelrouter/core.ts
|
|
5190
5257
|
init_logger();
|
|
5191
5258
|
var DEFAULT_API_URL5 = "https://api.morphllm.com";
|
|
@@ -6749,6 +6816,8 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
6749
6816
|
compact;
|
|
6750
6817
|
/** Reflex: train and serve small text classifiers */
|
|
6751
6818
|
reflex;
|
|
6819
|
+
/** Traces: read back turns shipped with `morphTracing()`, with their Reflex labels */
|
|
6820
|
+
traces;
|
|
6752
6821
|
/**
|
|
6753
6822
|
* Create a new Morph SDK client
|
|
6754
6823
|
*
|
|
@@ -6791,6 +6860,7 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
6791
6860
|
const compactClient = new CompactClient(this);
|
|
6792
6861
|
this.compact = compactClient.compact.bind(compactClient);
|
|
6793
6862
|
this.reflex = new ReflexClient(this);
|
|
6863
|
+
this.traces = new TracesClient(this);
|
|
6794
6864
|
this.openai = new OpenAIToolFactory(config);
|
|
6795
6865
|
this.anthropic = new AnthropicToolFactory(config);
|
|
6796
6866
|
this.vercel = new VercelToolFactory(config);
|