dimies 0.1.0 → 0.1.1
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/README.md +18 -0
- package/bin/dimies.js +9 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,4 +32,22 @@ Paste into Claude Code (or Cursor, etc.) inside the repo you want instrumented.
|
|
|
32
32
|
| `--dir path` | Target directory for `init` (default `.`) |
|
|
33
33
|
| `--lang node\|python` | Override language detection |
|
|
34
34
|
|
|
35
|
+
## Tracing
|
|
36
|
+
|
|
37
|
+
Pass a `trace` array of spans to `trackConversation(...)` to get a Langfuse-style execution tree on each conversation. Give every span a stable `id`, and set `input`/`output` to the payload — for an `llm` span, the prompt and the completion; for a `tool` span, the args and the result:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
trackConversation({
|
|
41
|
+
conversation_id: chat.id,
|
|
42
|
+
messages,
|
|
43
|
+
trace: [
|
|
44
|
+
{ id: "llm-1", name: "vera.llm", type: "llm",
|
|
45
|
+
model: "gpt-4o", tokens_in: 1240, tokens_out: 85,
|
|
46
|
+
input: prompt, output: completion },
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Field names are **exact** — `prompt`/`completion`/`response` are silently dropped, so a span sent that way shows *"No payload recorded"*. Merge is field-level and keyed by `id`: resend the same `id` to update a span (e.g. `{ id: "llm-1", status: "error" }`) and only the fields you include change — the rest is preserved. Full span schema: `<your-instance>/llms.txt`.
|
|
52
|
+
|
|
35
53
|
MIT.
|
package/bin/dimies.js
CHANGED
|
@@ -64,8 +64,9 @@ type DimiesSpan = {
|
|
|
64
64
|
type?: "llm" | "tool" | "retrieval" | "function" | "other";
|
|
65
65
|
started_at?: number | string;
|
|
66
66
|
ended_at?: number | string;
|
|
67
|
-
input?: unknown;
|
|
68
|
-
output?: unknown;
|
|
67
|
+
input?: unknown; // the payload shown when you click the span. llm: the prompt/messages;
|
|
68
|
+
output?: unknown; // tool: args/result; retrieval: query/docs. Names are exact — "prompt"
|
|
69
|
+
// or "completion" are dropped. Resend only the fields you change.
|
|
69
70
|
model?: string;
|
|
70
71
|
tokens_in?: number;
|
|
71
72
|
tokens_out?: number;
|
|
@@ -173,8 +174,12 @@ const AGENT_PROMPT = (baseUrl) => `Integrate Dimies conversation analytics into
|
|
|
173
174
|
(details in the spec).
|
|
174
175
|
4. Read DIMIES_API_KEY and DIMIES_URL from environment variables; add them
|
|
175
176
|
to .env.example. Never hardcode the key.
|
|
176
|
-
5. If the app has
|
|
177
|
-
|
|
177
|
+
5. If the app has LLM / tool / retrieval steps, also send them as a "trace" array
|
|
178
|
+
(span schema in the spec) so executions are debuggable. On each span set
|
|
179
|
+
"input" and "output" (exact field names) to the payload — for an llm span that
|
|
180
|
+
is the prompt and the completion; for a tool span the args and the result.
|
|
181
|
+
Without them the span shows "No payload recorded". Give every span a stable
|
|
182
|
+
"id" and resend only the fields you change.
|
|
178
183
|
6. Verify: run the app, trigger one conversation, and confirm it appears at
|
|
179
184
|
${baseUrl}/app (or run \`npx dimies test --key $DIMIES_API_KEY\`).
|
|
180
185
|
|
package/package.json
CHANGED