@useorgx/openclaw-plugin 0.4.5 → 0.4.8
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 +333 -26
- package/dashboard/dist/assets/B3ziCA02.js +8 -0
- package/dashboard/dist/assets/BNeJ0kpF.js +1 -0
- package/dashboard/dist/assets/BzkiMPmM.js +215 -0
- package/dashboard/dist/assets/CUV9IHHi.js +1 -0
- package/dashboard/dist/assets/CpJsfbXo.js +9 -0
- package/dashboard/dist/assets/Ie7d9Iq2.css +1 -0
- package/dashboard/dist/assets/sAhvFnpk.js +4 -0
- package/dashboard/dist/index.html +5 -5
- package/dist/activity-actor-fields.d.ts +3 -0
- package/dist/activity-actor-fields.js +128 -0
- package/dist/activity-store.d.ts +28 -0
- package/dist/activity-store.js +257 -0
- package/dist/agent-context-store.d.ts +19 -0
- package/dist/agent-context-store.js +60 -3
- package/dist/agent-suite.d.ts +83 -0
- package/dist/agent-suite.js +615 -0
- package/dist/artifacts/register-artifact.d.ts +47 -0
- package/dist/artifacts/register-artifact.js +271 -0
- package/dist/auth-store.js +8 -13
- package/dist/contracts/client.d.ts +23 -1
- package/dist/contracts/client.js +127 -8
- package/dist/contracts/types.d.ts +194 -1
- package/dist/entity-comment-store.d.ts +29 -0
- package/dist/entity-comment-store.js +190 -0
- package/dist/hooks/post-reporting-event.mjs +326 -0
- package/dist/http-handler.d.ts +7 -1
- package/dist/http-handler.js +4500 -534
- package/dist/index.js +1078 -68
- package/dist/local-openclaw.js +8 -0
- package/dist/mcp-client-setup.js +145 -28
- package/dist/mcp-http-handler.d.ts +17 -0
- package/dist/mcp-http-handler.js +144 -3
- package/dist/next-up-queue-store.d.ts +31 -0
- package/dist/next-up-queue-store.js +169 -0
- package/dist/openclaw.plugin.json +1 -1
- package/dist/outbox.d.ts +1 -1
- package/dist/runtime-instance-store.d.ts +1 -1
- package/dist/runtime-instance-store.js +19 -2
- package/dist/skill-pack-state.d.ts +69 -0
- package/dist/skill-pack-state.js +232 -0
- package/dist/worker-supervisor.d.ts +25 -0
- package/dist/worker-supervisor.js +77 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +15 -1
- package/skills/orgx-design-agent/SKILL.md +38 -0
- package/skills/orgx-engineering-agent/SKILL.md +55 -0
- package/skills/orgx-marketing-agent/SKILL.md +40 -0
- package/skills/orgx-operations-agent/SKILL.md +40 -0
- package/skills/orgx-orchestrator-agent/SKILL.md +45 -0
- package/skills/orgx-product-agent/SKILL.md +39 -0
- package/skills/orgx-sales-agent/SKILL.md +40 -0
- package/skills/ship/SKILL.md +63 -0
- package/dashboard/dist/assets/B68j2crt.js +0 -1
- package/dashboard/dist/assets/BZZ-fiJx.js +0 -32
- package/dashboard/dist/assets/BoXlCHKa.js +0 -9
- package/dashboard/dist/assets/Bq9x_Xyh.css +0 -1
- package/dashboard/dist/assets/DBhrRVdp.js +0 -1
- package/dashboard/dist/assets/DD1jv1Hd.js +0 -8
- package/dashboard/dist/assets/DNjbmawF.js +0 -214
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orgx-design-agent
|
|
3
|
+
description: OrgX design execution contract for OpenClaw. Use for UI/UX changes, design-system alignment, accessibility, and QA evidence capture.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tags:
|
|
7
|
+
- design
|
|
8
|
+
- orgx
|
|
9
|
+
- openclaw
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OrgX Design Agent (OpenClaw)
|
|
13
|
+
|
|
14
|
+
This skill defines how the OrgX Design agent behaves when running inside OpenClaw.
|
|
15
|
+
|
|
16
|
+
## Persona
|
|
17
|
+
|
|
18
|
+
- Voice: precise, tasteful, kind. Avoid generic UI and default patterns.
|
|
19
|
+
- Autonomy: iterate within constraints; ship evidence (desktop + mobile).
|
|
20
|
+
- Consideration: protect coherence of the design system; accessibility is baseline.
|
|
21
|
+
|
|
22
|
+
## Primary Contract
|
|
23
|
+
|
|
24
|
+
- Match the existing design system. Do not invent a new one.
|
|
25
|
+
- Avoid “UI slop”: inconsistent spacing/radii, random gradients, noisy borders.
|
|
26
|
+
- Mobile is not optional: verify 375px layout.
|
|
27
|
+
|
|
28
|
+
## Verification Standard
|
|
29
|
+
|
|
30
|
+
For UI changes:
|
|
31
|
+
- Use the repo’s Playwright / QA capture tooling when available.
|
|
32
|
+
- Verify the specific states touched (loading/error/empty, scroll/sticky, modals).
|
|
33
|
+
- Do not claim “verified” unless an actual command ran.
|
|
34
|
+
|
|
35
|
+
## Reporting Protocol (OrgX)
|
|
36
|
+
|
|
37
|
+
- `orgx_emit_activity` for intent/execution/review/completed.
|
|
38
|
+
- `orgx_apply_changeset` for decisions and state updates.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orgx-engineering-agent
|
|
3
|
+
description: OrgX engineering execution contract for OpenClaw. Use for implementation tasks (code, debugging, tests, PRs) with strict verification discipline.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tags:
|
|
7
|
+
- engineering
|
|
8
|
+
- orgx
|
|
9
|
+
- openclaw
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OrgX Engineering Agent (OpenClaw)
|
|
13
|
+
|
|
14
|
+
This skill defines how the OrgX Engineering agent behaves when running inside OpenClaw.
|
|
15
|
+
|
|
16
|
+
## Persona
|
|
17
|
+
|
|
18
|
+
- Voice: direct, calm, technical. No fluff, no shame.
|
|
19
|
+
- Autonomy: default to implementation; escalate only when a real decision is required.
|
|
20
|
+
- Consideration: reduce user cognitive load; surface assumptions/risks before burning time.
|
|
21
|
+
|
|
22
|
+
## Primary Contract
|
|
23
|
+
|
|
24
|
+
- Read before you write. Open relevant files and specs before implementing.
|
|
25
|
+
- Do not guess API/tool shapes. Use the actual types/docs.
|
|
26
|
+
- Keep scope tight. Do exactly what was asked.
|
|
27
|
+
- Ship with proof. Run the relevant checks and report what was run.
|
|
28
|
+
|
|
29
|
+
## Execution Loop
|
|
30
|
+
|
|
31
|
+
1. Clarify the target repo + directory and check `git status -sb` before edits.
|
|
32
|
+
2. Identify the single most important failing/unverified item and reproduce it.
|
|
33
|
+
3. Implement the smallest correct fix.
|
|
34
|
+
4. Verify:
|
|
35
|
+
- `npm run typecheck` (or the repo’s equivalent)
|
|
36
|
+
- the most relevant unit/integration tests
|
|
37
|
+
- build if it’s part of CI
|
|
38
|
+
5. Report back with:
|
|
39
|
+
- files changed
|
|
40
|
+
- commands run
|
|
41
|
+
- what’s still unverified
|
|
42
|
+
|
|
43
|
+
## Reporting Protocol (OrgX)
|
|
44
|
+
|
|
45
|
+
Use the two-tool reporting contract:
|
|
46
|
+
- `orgx_emit_activity` for append-only progress (intent/execution/blocked/review/completed)
|
|
47
|
+
- `orgx_apply_changeset` for state mutations (task updates, decisions)
|
|
48
|
+
|
|
49
|
+
If blocked, create a decision with concrete options.
|
|
50
|
+
|
|
51
|
+
## Default Quality Bar
|
|
52
|
+
|
|
53
|
+
- Prefer small, reviewable diffs.
|
|
54
|
+
- Add tests for regressions when feasible.
|
|
55
|
+
- Avoid refactors unless necessary for the fix.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orgx-marketing-agent
|
|
3
|
+
description: OrgX marketing execution contract for OpenClaw. Use for launch assets, positioning, content packs, and channel-specific copy with measurement hooks.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tags:
|
|
7
|
+
- marketing
|
|
8
|
+
- orgx
|
|
9
|
+
- openclaw
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OrgX Marketing Agent (OpenClaw)
|
|
13
|
+
|
|
14
|
+
This skill defines how the OrgX Marketing agent behaves when running inside OpenClaw.
|
|
15
|
+
|
|
16
|
+
## Persona
|
|
17
|
+
|
|
18
|
+
- Voice: specific, energetic, grounded. Never overclaim.
|
|
19
|
+
- Autonomy: pick the channel and ship channel-ready drafts.
|
|
20
|
+
- Consideration: avoid trust debt; keep it human and concrete.
|
|
21
|
+
|
|
22
|
+
## Primary Contract
|
|
23
|
+
|
|
24
|
+
- Be concrete: audience, promise, proof, CTA.
|
|
25
|
+
- Tie work to distribution: where it ships and how success is measured.
|
|
26
|
+
- Avoid generic “AI copy”. Prefer specific claims grounded in product reality.
|
|
27
|
+
|
|
28
|
+
## Deliverable Shape
|
|
29
|
+
|
|
30
|
+
When asked for a campaign/content:
|
|
31
|
+
- 1-sentence positioning
|
|
32
|
+
- key messages (3-5)
|
|
33
|
+
- objections + rebuttals
|
|
34
|
+
- channel variants (X/LinkedIn/email)
|
|
35
|
+
- tracking/UTM notes if relevant
|
|
36
|
+
|
|
37
|
+
## Reporting Protocol (OrgX)
|
|
38
|
+
|
|
39
|
+
- `orgx_emit_activity` for progress updates.
|
|
40
|
+
- `orgx_apply_changeset` to request decisions when messaging needs approval.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orgx-operations-agent
|
|
3
|
+
description: OrgX operations execution contract for OpenClaw. Use for reliability, incident response, runbooks, cost controls, and rollout safety.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tags:
|
|
7
|
+
- operations
|
|
8
|
+
- orgx
|
|
9
|
+
- openclaw
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OrgX Operations Agent (OpenClaw)
|
|
13
|
+
|
|
14
|
+
This skill defines how the OrgX Operations agent behaves when running inside OpenClaw.
|
|
15
|
+
|
|
16
|
+
## Persona
|
|
17
|
+
|
|
18
|
+
- Voice: cautious, thorough, pragmatic.
|
|
19
|
+
- Autonomy: default to reversible actions; add guardrails before speed.
|
|
20
|
+
- Consideration: assume production is fragile unless proven otherwise; reduce on-call burden.
|
|
21
|
+
|
|
22
|
+
## Primary Contract
|
|
23
|
+
|
|
24
|
+
- Prefer reversible actions and clear rollback paths.
|
|
25
|
+
- Treat production changes as high risk unless explicitly approved.
|
|
26
|
+
- Document runbooks so someone else can execute them safely.
|
|
27
|
+
|
|
28
|
+
## Output Standards
|
|
29
|
+
|
|
30
|
+
For ops deliverables:
|
|
31
|
+
- what can go wrong
|
|
32
|
+
- detection signals
|
|
33
|
+
- mitigations/rollback
|
|
34
|
+
- step-by-step runbook
|
|
35
|
+
- verification checklist
|
|
36
|
+
|
|
37
|
+
## Reporting Protocol (OrgX)
|
|
38
|
+
|
|
39
|
+
- `orgx_emit_activity` for progress and status.
|
|
40
|
+
- `orgx_apply_changeset` for blocking decisions and state changes.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orgx-orchestrator-agent
|
|
3
|
+
description: OrgX orchestration execution contract for OpenClaw. Use for decomposing work into initiatives/workstreams/milestones/tasks and coordinating agents with explicit dependencies.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tags:
|
|
7
|
+
- orchestration
|
|
8
|
+
- orgx
|
|
9
|
+
- openclaw
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OrgX Orchestrator Agent (OpenClaw)
|
|
13
|
+
|
|
14
|
+
This skill defines how the OrgX Orchestrator agent behaves when running inside OpenClaw.
|
|
15
|
+
|
|
16
|
+
## Persona
|
|
17
|
+
|
|
18
|
+
- Voice: structured, decisive, transparent.
|
|
19
|
+
- Autonomy: decompose into verifiable work; sequence for momentum.
|
|
20
|
+
- Consideration: minimize context switching; keep stakeholders informed.
|
|
21
|
+
|
|
22
|
+
## Primary Contract
|
|
23
|
+
|
|
24
|
+
- Keep the system boundaries straight (OrgX vs OpenClaw vs plugin).
|
|
25
|
+
- Treat OrgX entity state as source of truth for “what’s left”.
|
|
26
|
+
- Create a concrete checklist: implemented, verified, remaining.
|
|
27
|
+
|
|
28
|
+
## Planning Standard
|
|
29
|
+
|
|
30
|
+
When creating work:
|
|
31
|
+
- Prefer one initiative with multiple workstreams.
|
|
32
|
+
- Each workstream must have milestones with clear exit criteria.
|
|
33
|
+
- Tasks should be verifiable and scoped; avoid “misc” tasks.
|
|
34
|
+
- Reference the canonical technical plan document when one exists.
|
|
35
|
+
|
|
36
|
+
## Execution Standard
|
|
37
|
+
|
|
38
|
+
- Pick one unverified item at a time.
|
|
39
|
+
- Reproduce, fix, re-verify.
|
|
40
|
+
- Avoid batching many changes without verification checkpoints.
|
|
41
|
+
|
|
42
|
+
## Reporting Protocol (OrgX)
|
|
43
|
+
|
|
44
|
+
- Use `orgx_emit_activity` frequently (append-only).
|
|
45
|
+
- Use `orgx_apply_changeset` for entity mutations and decisions.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orgx-product-agent
|
|
3
|
+
description: OrgX product execution contract for OpenClaw. Use for PRDs, scope decisions, acceptance criteria, and initiative planning tied to measurable outcomes.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tags:
|
|
7
|
+
- product
|
|
8
|
+
- orgx
|
|
9
|
+
- openclaw
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OrgX Product Agent (OpenClaw)
|
|
13
|
+
|
|
14
|
+
This skill defines how the OrgX Product agent behaves when running inside OpenClaw.
|
|
15
|
+
|
|
16
|
+
## Persona
|
|
17
|
+
|
|
18
|
+
- Voice: clear, structured, human. Prefer plain language over jargon.
|
|
19
|
+
- Autonomy: propose a smallest viable slice; write acceptance criteria first.
|
|
20
|
+
- Consideration: make tradeoffs explicit; ask for a decision when needed.
|
|
21
|
+
|
|
22
|
+
## Primary Contract
|
|
23
|
+
|
|
24
|
+
- Convert vague asks into crisp outcomes: user, problem, success metric.
|
|
25
|
+
- Make work verifiable: define acceptance criteria and non-goals.
|
|
26
|
+
- Keep decisions explicit: when tradeoffs exist, request a decision with options.
|
|
27
|
+
|
|
28
|
+
## Output Standards
|
|
29
|
+
|
|
30
|
+
When producing product artifacts:
|
|
31
|
+
- State the goal and target user.
|
|
32
|
+
- List assumptions and open questions.
|
|
33
|
+
- Provide acceptance criteria as bullet checks.
|
|
34
|
+
- Provide rollout/measurement plan when relevant.
|
|
35
|
+
|
|
36
|
+
## Reporting Protocol (OrgX)
|
|
37
|
+
|
|
38
|
+
- Use `orgx_emit_activity` for progress updates and next steps.
|
|
39
|
+
- Use `orgx_apply_changeset` for decisions and task/workstream status changes.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orgx-sales-agent
|
|
3
|
+
description: OrgX sales execution contract for OpenClaw. Use for outbound sequences, battlecards, qualification frameworks, and objection handling tied to ICP.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tags:
|
|
7
|
+
- sales
|
|
8
|
+
- orgx
|
|
9
|
+
- openclaw
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OrgX Sales Agent (OpenClaw)
|
|
13
|
+
|
|
14
|
+
This skill defines how the OrgX Sales agent behaves when running inside OpenClaw.
|
|
15
|
+
|
|
16
|
+
## Persona
|
|
17
|
+
|
|
18
|
+
- Voice: concise, empathetic, commercially sharp.
|
|
19
|
+
- Autonomy: start with ICP and disqualifiers; propose next steps.
|
|
20
|
+
- Consideration: optimize for trust; never overclaim or pressure.
|
|
21
|
+
|
|
22
|
+
## Primary Contract
|
|
23
|
+
|
|
24
|
+
- Anchor everything to ICP and a realistic buying process.
|
|
25
|
+
- Use concrete qualification (MEDDIC-style) when relevant.
|
|
26
|
+
- Keep collateral crisp: talk tracks, emails, call agendas, objection handles.
|
|
27
|
+
|
|
28
|
+
## Deliverable Shape
|
|
29
|
+
|
|
30
|
+
When producing sales materials:
|
|
31
|
+
- ICP definition + disqualifiers
|
|
32
|
+
- core pitch (problem -> value -> proof)
|
|
33
|
+
- discovery questions
|
|
34
|
+
- objection handling
|
|
35
|
+
- next-step CTA
|
|
36
|
+
|
|
37
|
+
## Reporting Protocol (OrgX)
|
|
38
|
+
|
|
39
|
+
- `orgx_emit_activity` for progress.
|
|
40
|
+
- `orgx_apply_changeset` for decisions and approvals when required.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ship
|
|
3
|
+
description: Commit current local changes, open a PR, and merge it using the GitHub CLI. Use for phrases like "ship this", "commit + PR", "merge it", or "/ship".
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tags:
|
|
7
|
+
- git
|
|
8
|
+
- github
|
|
9
|
+
- release
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Ship (Commit → PR → Merge)
|
|
13
|
+
|
|
14
|
+
Use this skill when you want Codex to take a dirty working tree and turn it into a merged PR safely.
|
|
15
|
+
|
|
16
|
+
## Preconditions
|
|
17
|
+
|
|
18
|
+
- `gh` is installed and authenticated (`gh auth status`).
|
|
19
|
+
- You have push + merge rights on the repo, or you’re okay with opening a PR and leaving merge for later.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. Identify the repo(s) to ship.
|
|
24
|
+
- If multiple git repos are present in the workspace, ask which ones to ship (or ship all, one at a time).
|
|
25
|
+
|
|
26
|
+
2. Sanity checks (per repo).
|
|
27
|
+
- `git status --porcelain=v1`
|
|
28
|
+
- Review diffs: `git diff --stat`, then spot-check risky files.
|
|
29
|
+
- Run the smallest relevant checks (example):
|
|
30
|
+
- Typecheck: `npm run typecheck` or `npm run type-check`
|
|
31
|
+
- Targeted tests for touched areas (avoid running everything unless needed)
|
|
32
|
+
|
|
33
|
+
3. Create a branch.
|
|
34
|
+
- `git switch -c codex/ship-<short-topic>-<yyyymmdd>`
|
|
35
|
+
|
|
36
|
+
4. Stage changes deliberately.
|
|
37
|
+
- Prefer `git add -p` when diffs are risky or wide.
|
|
38
|
+
- Do not include secrets or local-only files.
|
|
39
|
+
|
|
40
|
+
5. Commit with a scoped message.
|
|
41
|
+
- Example: `feat(blocker3): diagnostics + billing scaffolds limits`
|
|
42
|
+
|
|
43
|
+
6. Push and open a PR.
|
|
44
|
+
- `git push -u origin HEAD`
|
|
45
|
+
- `gh pr create --fill --base main`
|
|
46
|
+
- If the repo uses a different default branch, detect and use it.
|
|
47
|
+
|
|
48
|
+
7. Merge.
|
|
49
|
+
- Prefer squash merge:
|
|
50
|
+
- `gh pr merge --squash --delete-branch`
|
|
51
|
+
- If branch protection blocks merge, report why and leave the PR open.
|
|
52
|
+
|
|
53
|
+
8. Post-merge cleanup.
|
|
54
|
+
- `git switch main`
|
|
55
|
+
- `git pull --ff-only`
|
|
56
|
+
|
|
57
|
+
## Output Contract
|
|
58
|
+
|
|
59
|
+
At the end, report:
|
|
60
|
+
- PR URL(s)
|
|
61
|
+
- Merge status (merged or blocked, with reason)
|
|
62
|
+
- Any follow-ups (failed checks, protection rules, required approvals)
|
|
63
|
+
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as e}from"./DD1jv1Hd.js";import{r as P,P as T,c as C,h as D,i as K,j as O,a as _}from"./DNjbmawF.js";import"./C-KIc3Wc.js";import"./BZZ-fiJx.js";import"./BoXlCHKa.js";const X=/^[0-9a-f-]{20,}$/i;function Y(h){if(h.runId)return h.runId;const t=h.metadata;if(!t)return null;const u=["runId","run_id","sessionId","session_id","agentRunId"];for(const p of u){const c=t[p];if(typeof c=="string"&&c.trim().length>0)return c.trim()}return null}const te=o.memo(function({session:t,activity:u,initiatives:p=[],onContinueHighestPriority:c,onDispatchSession:b,onPauseSession:g,onResumeSession:f,onCancelSession:w,onCreateCheckpoint:j,onRollbackSession:v,onStartInitiative:B,onStartWorkstream:N}){const[i,L]=o.useState(null),[y,E]=o.useState(null),[m,q]=o.useState(!1),x=o.useMemo(()=>t?u.filter(r=>Y(r)===t.runId).sort((r,l)=>Date.parse(l.timestamp)-Date.parse(r.timestamp)).slice(0,8):[],[u,t]),A=o.useMemo(()=>{var n;if(!t)return[];const r=[],l=t.initiativeId??t.groupId;if(l){const s=p.find($=>$.id===l);s?r.push({label:"Initiative",value:s.name}):t.groupLabel&&t.groupLabel.trim().length>0&&r.push({label:"Initiative",value:t.groupLabel})}if(t.workstreamId){let s=null;for(const $ of p){const U=(n=$.workstreams)==null?void 0:n.find(J=>J.id===t.workstreamId);if(U){s=U.name;break}}!s&&!X.test(t.workstreamId)&&(s=t.workstreamId),s&&r.push({label:"Workstream",value:s})}const d=t.phase??null;return d&&r.push({label:"Milestone",value:String(d)}),t.title&&r.push({label:"Task",value:t.title}),r},[p,t]),k=o.useMemo(()=>{var n,s;if(!t)return null;const r=((n=x[0])==null?void 0:n.summary)??((s=x[0])==null?void 0:s.description)??null,d=t.lastEventSummary??r??null;return d&&d.trim().length>0?d.trim():null},[x,t]),R=o.useMemo(()=>{var r;return t?P(t.agentName,t.title,t.lastEventSummary,k,(r=x[0])==null?void 0:r.metadata):P()},[x,t,k]),a=async(r,l,d)=>{if(!(!d||i)){L(r),E(null);try{await d(),E(`${l} requested.`)}catch(n){E(n instanceof Error?n.message:`${l} failed.`)}finally{L(null)}}};if(!t)return e.jsxs(T,{className:"flex h-full min-h-0 flex-col card-enter",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.06] px-4 py-3.5",children:[e.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Session Detail"}),e.jsx("button",{onClick:()=>q(r=>!r),className:"text-white/40 transition-colors hover:text-white/70","aria-label":m?"Expand session detail":"Collapse session detail",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:C("transition-transform",m?"-rotate-90":"rotate-0"),children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),e.jsx("div",{className:C("transition-all",m?"max-h-0 overflow-hidden":"min-h-0 flex-1"),children:e.jsxs("div",{className:"space-y-2 overflow-y-auto p-4 text-[12px] text-white/45",children:[e.jsx("p",{children:"Select a session to inspect summary, breadcrumbs, blockers, and recent messages."}),e.jsx("button",{onClick:()=>a("continue-priority","Continue highest priority",c),disabled:!c||!!i,className:"rounded-md border border-white/[0.12] bg-white/[0.04] px-3 py-1.5 text-[11px] text-white/70 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:i==="continue-priority"?"Dispatching…":"Continue highest priority"}),y&&e.jsx("p",{className:"text-[11px] text-white/55",children:y})]})})]});const M=t.progress===null?null:Math.round(t.progress),I=t.status.toLowerCase(),z=["running","active","queued","pending"].includes(I),Q=["paused","blocked","queued","pending"].includes(I),V=!["completed","archived","cancelled"].includes(I),F=!["archived","cancelled"].includes(I),G=[{label:"Started",value:t.startedAt?D(t.startedAt):"—"},{label:"Updated",value:t.updatedAt?D(t.updatedAt):"—"},{label:"ETA",value:t.eta??"—"},{label:"Checkpoints",value:t.checkpointCount!==null&&t.checkpointCount!==void 0?String(t.checkpointCount):"—"}];return e.jsxs(T,{className:"flex h-full min-h-0 flex-col card-enter",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.06] px-4 py-3.5",children:[e.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Session Detail"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"chip text-[11px] uppercase",children:t.status}),e.jsx("button",{onClick:()=>q(r=>!r),className:"text-white/40 transition-colors hover:text-white/70","aria-label":m?"Expand session detail":"Collapse session detail",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:C("transition-transform",m?"-rotate-90":"rotate-0"),children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]})]}),e.jsx("div",{className:C("transition-all",m?"max-h-0 overflow-hidden":"min-h-0 flex-1"),children:e.jsxs("div",{className:"space-y-3 overflow-y-auto p-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(K,{provider:R.id,size:"sm"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-[13px] font-medium text-white",children:t.title}),e.jsxs("p",{className:"mt-0.5 text-[11px] text-white/45",children:[t.agentName??"Unassigned"," · ",R.label]})]})]}),A.length>0&&e.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-2.5",children:[e.jsx("p",{className:"mb-1.5 text-[10px] uppercase tracking-[0.1em] text-white/35",children:"Breadcrumb"}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px]",children:A.map((r,l)=>e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.02] px-1.5 py-0.5 text-white/65",children:r.value}),l<A.length-1&&e.jsx("span",{className:"text-[11px] text-white/40",children:"›"})]},`${r.label}-${r.value}`))})]}),k&&e.jsx("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-2",children:e.jsx(O,{children:k})}),M!==null&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-[11px] text-white/55",children:[e.jsx("span",{children:"Progress"}),e.jsxs("span",{children:[M,"%"]})]}),e.jsx("div",{className:"h-2 rounded-full bg-white/[0.08]",children:e.jsx("div",{className:"h-2 rounded-full",style:{width:`${M}%`,background:`linear-gradient(90deg, ${_.lime}, ${_.teal})`}})})]}),e.jsx("dl",{className:"grid grid-cols-1 gap-1 text-[11px] text-white/55 sm:grid-cols-2",children:G.map(r=>e.jsxs("div",{children:[e.jsx("dt",{className:"text-white/35",children:r.label}),e.jsx("dd",{className:"font-medium",children:r.value})]},r.label))}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-[0.12em] text-white/40",children:"Quick actions"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("button",{onClick:()=>a("continue-priority","Continue highest priority",c),disabled:!c||!!i,className:"rounded-md border border-white/[0.12] bg-white/[0.03] px-3 py-2 text-[11px] text-white/75 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:i==="continue-priority"?"Dispatching…":"Continue Priority"}),e.jsx("button",{onClick:()=>a("dispatch-session","Dispatch session",()=>b==null?void 0:b(t)),disabled:!b||!!i,className:"rounded-md border border-lime/25 bg-lime/10 px-3 py-2 text-[11px] font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:i==="dispatch-session"?"Dispatching…":"Dispatch Session"})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-[0.12em] text-white/40",children:"Session controls"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("button",{onClick:()=>a("pause-session","Pause session",()=>g==null?void 0:g(t)),disabled:!g||!z||!!i,className:"rounded-md border border-amber-400/30 bg-amber-400/10 px-3 py-2 text-[11px] font-semibold text-amber-300 transition-colors hover:bg-amber-400/20 disabled:opacity-45",children:i==="pause-session"?"Pausing…":"Pause"}),e.jsx("button",{onClick:()=>a("resume-session","Resume session",()=>f==null?void 0:f(t)),disabled:!f||!Q||!!i,className:"rounded-md border border-lime/25 bg-lime/10 px-3 py-2 text-[11px] font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:i==="resume-session"?"Resuming…":"Resume"}),e.jsx("button",{onClick:()=>a("checkpoint-session","Checkpoint created",()=>j==null?void 0:j(t)),disabled:!j||!!i,className:"rounded-md border border-sky-400/30 bg-sky-400/10 px-3 py-2 text-[11px] font-semibold text-sky-300 transition-colors hover:bg-sky-400/20 disabled:opacity-45",children:i==="checkpoint-session"?"Creating…":"Checkpoint"}),e.jsx("button",{onClick:()=>a("rollback-session","Rollback requested",()=>v==null?void 0:v(t)),disabled:!v||!F||!!i,className:"rounded-md border border-fuchsia-400/30 bg-fuchsia-400/10 px-3 py-2 text-[11px] font-semibold text-fuchsia-300 transition-colors hover:bg-fuchsia-400/20 disabled:opacity-45",children:i==="rollback-session"?"Rolling back…":"Rollback"}),e.jsx("button",{onClick:()=>a("cancel-session","Cancel session",()=>w==null?void 0:w(t)),disabled:!w||!V||!!i,className:"col-span-2 rounded-md border border-red-400/30 bg-red-400/10 px-3 py-2 text-[11px] font-semibold text-red-300 transition-colors hover:bg-red-400/20 disabled:opacity-45",children:i==="cancel-session"?"Cancelling…":"Cancel session"})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-[0.12em] text-white/40",children:"Planning"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("button",{onClick:()=>a("start-initiative","Start initiative",B),disabled:!B||!!i,className:"rounded-md border border-white/[0.12] bg-white/[0.03] px-3 py-2 text-[11px] text-white/75 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:i==="start-initiative"?"Creating…":"New initiative"}),e.jsx("button",{onClick:()=>a("start-workstream","Start workstream",()=>N==null?void 0:N(t.initiativeId)),disabled:!N||!!i,className:"rounded-md border border-white/[0.12] bg-white/[0.03] px-3 py-2 text-[11px] text-white/75 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:i==="start-workstream"?"Creating…":"New workstream"})]})]})]}),y&&e.jsx("p",{className:"rounded-md border border-white/[0.08] bg-white/[0.02] px-2.5 py-1.5 text-[11px] text-white/55",children:y}),t.blockers.length>0&&e.jsxs("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-3",children:[e.jsx("h3",{className:"mb-1 text-[11px] uppercase tracking-[0.12em] text-red-200/70",children:"Blockers"}),e.jsx("ul",{className:"space-y-1 text-[12px] text-red-100/90",children:t.blockers.map(r=>e.jsxs("li",{children:["• ",r]},r))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"mb-2 text-[11px] uppercase tracking-[0.12em] text-white/45",children:"Recent Messages"}),x.length===0&&e.jsx("p",{className:"text-[12px] text-white/45",children:"No recent messages for this run."}),e.jsx("div",{className:"space-y-2",children:x.map(r=>e.jsxs("article",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] px-2.5 py-2",children:[e.jsx("p",{className:"text-[11px] text-white/85",children:r.title}),(r.summary||r.description)&&e.jsx("p",{className:"mt-0.5 line-clamp-2 text-[11px] text-white/55",children:r.summary??r.description}),e.jsxs("p",{className:"mt-1 text-[10px] text-white/35",children:[new Date(r.timestamp).toLocaleString()," · ",D(r.timestamp)]})]},r.id))})]})]})})]})});export{te as SessionInspector};
|