create-orcha 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/bin/create-orcha.js +177 -0
  4. package/package.json +41 -0
  5. package/template/.env.example +2 -0
  6. package/template/AGENTS.md +30 -0
  7. package/template/README.md +50 -0
  8. package/template/orcha/AGENTS.md +913 -0
  9. package/template/orcha/approvalAgent/actions/requestHumanApproval/index.json +25 -0
  10. package/template/orcha/approvalAgent/evaluations/approvalQuality/index.json +22 -0
  11. package/template/orcha/approvalAgent/evaluations/index.js +5 -0
  12. package/template/orcha/approvalAgent/index.json +7 -0
  13. package/template/orcha/approvalAgent/instructions.md +5 -0
  14. package/template/orcha/approvalAgent/skills/index.js +5 -0
  15. package/template/orcha/approvalAgent/skills/purchaseReview/index.json +8 -0
  16. package/template/orcha/approvalAgent/skills/purchaseReview/instructions.md +5 -0
  17. package/template/orcha/approvalAgent/tests/approvedPurchase/index.json +36 -0
  18. package/template/orcha/approvalAgent/tests/index.js +5 -0
  19. package/template/orcha/assistant/evaluations/index.js +5 -0
  20. package/template/orcha/assistant/evaluations/responseQuality/index.json +22 -0
  21. package/template/orcha/assistant/index.json +7 -0
  22. package/template/orcha/assistant/instructions.md +4 -0
  23. package/template/orcha/assistant/skills/index.js +5 -0
  24. package/template/orcha/assistant/skills/technicalExplanation/index.json +8 -0
  25. package/template/orcha/assistant/skills/technicalExplanation/instructions.md +6 -0
  26. package/template/orcha/assistant/tests/explainsIdempotency/index.json +15 -0
  27. package/template/orcha/assistant/tests/index.js +5 -0
  28. package/template/orcha/index.ts +15 -0
  29. package/template/orcha/orderSupport/actions/lookupOrder/index.js +25 -0
  30. package/template/orcha/orderSupport/actions/lookupOrder/index.json +29 -0
  31. package/template/orcha/orderSupport/evaluations/index.js +5 -0
  32. package/template/orcha/orderSupport/evaluations/supportQuality/index.json +22 -0
  33. package/template/orcha/orderSupport/index.json +7 -0
  34. package/template/orcha/orderSupport/instructions.md +5 -0
  35. package/template/orcha/orderSupport/skills/delayedOrderHandling/index.json +8 -0
  36. package/template/orcha/orderSupport/skills/delayedOrderHandling/instructions.md +6 -0
  37. package/template/orcha/orderSupport/skills/index.js +5 -0
  38. package/template/orcha/orderSupport/tests/delayedOrder/index.json +37 -0
  39. package/template/orcha/orderSupport/tests/index.js +5 -0
  40. package/template/package.json +25 -0
  41. package/template/playground.json +49 -0
  42. package/template/public/app.js +1234 -0
  43. package/template/public/index.html +210 -0
  44. package/template/public/orcha-logo.svg +4 -0
  45. package/template/public/styles.css +548 -0
  46. package/template/scripts/build.mjs +20 -0
  47. package/template/src/server.ts +478 -0
  48. package/template/tsconfig.json +12 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "request_human_approval",
3
+ "description": "Ask the application for a human purchase decision.",
4
+ "execution": "client",
5
+ "parameters": {
6
+ "type": "object",
7
+ "properties": {
8
+ "amount": { "type": "number" },
9
+ "currency": { "type": "string" },
10
+ "reason": { "type": "string" }
11
+ },
12
+ "required": ["amount", "currency", "reason"],
13
+ "additionalProperties": false
14
+ },
15
+ "outputSchema": {
16
+ "type": "object",
17
+ "properties": {
18
+ "approved": { "type": "boolean" },
19
+ "note": { "type": "string" }
20
+ },
21
+ "required": ["approved", "note"],
22
+ "additionalProperties": false
23
+ },
24
+ "sideEffect": true
25
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "approval_quality",
3
+ "description": "Human approval fidelity and process compliance.",
4
+ "instructions": "Judge whether the final purchase response faithfully follows the recorded human decision. Verify that the agent requested approval before declaring an outcome and that it reproduced the decision and reviewer note without alteration.",
5
+ "enabled": true,
6
+ "provider": "openai",
7
+ "model": "gpt-5-mini",
8
+ "maxTokens": 4000,
9
+ "reasoningLevel": "minimal",
10
+ "metrics": [
11
+ {
12
+ "name": "decision_fidelity",
13
+ "description": "The response reports the recorded human approval decision and note without alteration.",
14
+ "threshold": 0.9
15
+ },
16
+ {
17
+ "name": "process_compliance",
18
+ "description": "The agent requests human approval before declaring the purchase approved or rejected.",
19
+ "threshold": 0.9
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,5 @@
1
+ import { defineEvaluations } from "orchajs/evaluations";
2
+
3
+ export default defineEvaluations({
4
+ approvalQuality: "./approvalQuality",
5
+ });
@@ -0,0 +1,7 @@
1
+ {
2
+ "provider": "openai",
3
+ "model": "gpt-5-mini",
4
+ "region": "provider_managed",
5
+ "maxTokens": 4096,
6
+ "outputType": "text"
7
+ }
@@ -0,0 +1,5 @@
1
+ You review purchase requests.
2
+
3
+ Before declaring any purchase approved, call request_human_approval with the
4
+ amount, currency, and concise reason. Treat the returned decision as
5
+ authoritative and explain it clearly.
@@ -0,0 +1,5 @@
1
+ import { defineSkills } from "orchajs/skills";
2
+
3
+ export default defineSkills({
4
+ purchaseReview: "./purchaseReview",
5
+ });
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "purchase_review",
3
+ "description": "Prepare a concise, decision-ready purchase approval request.",
4
+ "triggers": [
5
+ "The user asks whether a purchase can be approved.",
6
+ "A purchase request includes an amount and business reason."
7
+ ]
8
+ }
@@ -0,0 +1,5 @@
1
+ Extract the amount, currency, and business justification from the request.
2
+
3
+ Send a short factual reason to the approval action. Do not recommend approval
4
+ before the action returns. Afterward, report the human decision and note
5
+ without changing or embellishing either.
@@ -0,0 +1,36 @@
1
+ {
2
+ "description": "Requests human approval before reporting a purchase decision.",
3
+ "input": {
4
+ "content": "Request approval for a 1250 USD annual observability subscription needed by the platform team."
5
+ },
6
+ "actions": {
7
+ "request_human_approval": {
8
+ "responses": [
9
+ {
10
+ "output": {
11
+ "approved": true,
12
+ "note": "Approved within the platform tooling budget."
13
+ }
14
+ }
15
+ ]
16
+ }
17
+ },
18
+ "expect": {
19
+ "status": "completed",
20
+ "text": {
21
+ "contains": ["approved"],
22
+ "excludes": ["rejected"]
23
+ },
24
+ "actions": [
25
+ {
26
+ "name": "request_human_approval",
27
+ "arguments": {
28
+ "partial": {
29
+ "amount": 1250,
30
+ "currency": "USD"
31
+ }
32
+ }
33
+ }
34
+ ]
35
+ }
36
+ }
@@ -0,0 +1,5 @@
1
+ import { defineTests } from "orchajs/testing";
2
+
3
+ export default defineTests({
4
+ approvedPurchase: "./approvedPurchase",
5
+ });
@@ -0,0 +1,5 @@
1
+ import { defineEvaluations } from "orchajs/evaluations";
2
+
3
+ export default defineEvaluations({
4
+ responseQuality: "./responseQuality",
5
+ });
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "response_quality",
3
+ "description": "Clarity and calibration of general assistant responses.",
4
+ "instructions": "Judge the complete assistant response for clarity, factual accuracy, and appropriate calibration. Reward direct explanations supported by the session, and penalize unsupported claims or assumptions presented as established facts.",
5
+ "enabled": true,
6
+ "provider": "openai",
7
+ "model": "gpt-5-mini",
8
+ "maxTokens": 4000,
9
+ "reasoningLevel": "minimal",
10
+ "metrics": [
11
+ {
12
+ "name": "clarity",
13
+ "description": "The response directly explains the requested concept in understandable language.",
14
+ "threshold": 0.8
15
+ },
16
+ {
17
+ "name": "calibration",
18
+ "description": "The response separates established facts from assumptions and avoids unsupported claims.",
19
+ "threshold": 0.8
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "provider": "openai",
3
+ "model": "gpt-5-mini",
4
+ "region": "provider_managed",
5
+ "maxTokens": 4096,
6
+ "outputType": "text"
7
+ }
@@ -0,0 +1,4 @@
1
+ You are a concise general assistant inside an Orcha playground.
2
+
3
+ Answer clearly and distinguish confirmed information from assumptions. When
4
+ information is missing, say what you would need rather than inventing it.
@@ -0,0 +1,5 @@
1
+ import { defineSkills } from "orchajs/skills";
2
+
3
+ export default defineSkills({
4
+ technicalExplanation: "./technicalExplanation",
5
+ });
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "technical_explanation",
3
+ "description": "Explain a technical concept accurately with a compact practical example.",
4
+ "triggers": [
5
+ "The user asks how a technical concept works.",
6
+ "The user requests an example that makes an abstract idea concrete."
7
+ ]
8
+ }
@@ -0,0 +1,6 @@
1
+ Define the concept in plain language first.
2
+
3
+ Then explain the mechanism in no more than three steps and give one realistic
4
+ example. Name an important limitation or common misunderstanding when it
5
+ materially affects correct use. Do not add terminology that the explanation
6
+ does not need.
@@ -0,0 +1,15 @@
1
+ {
2
+ "description": "Explains a technical concept with a practical example.",
3
+ "input": {
4
+ "content": "Explain idempotency in APIs with one practical example."
5
+ },
6
+ "actions": {},
7
+ "expect": {
8
+ "status": "completed",
9
+ "text": {
10
+ "contains": ["idempotent"],
11
+ "excludes": ["I cannot"]
12
+ },
13
+ "actions": []
14
+ }
15
+ }
@@ -0,0 +1,5 @@
1
+ import { defineTests } from "orchajs/testing";
2
+
3
+ export default defineTests({
4
+ explainsIdempotency: "./explainsIdempotency",
5
+ });
@@ -0,0 +1,15 @@
1
+ import { orcha } from "orchajs";
2
+
3
+ orcha.init({
4
+ providers: {
5
+ openai: process.env.OPENAI_API_KEY ?? "",
6
+ },
7
+ actions: {
8
+ runtime: "sandbox",
9
+ },
10
+ agents: {
11
+ approvalAgent: "./approvalAgent",
12
+ assistant: "./assistant",
13
+ orderSupport: "./orderSupport",
14
+ },
15
+ });
@@ -0,0 +1,25 @@
1
+ const orders = {
2
+ ord_1001: {
3
+ status: "in_transit",
4
+ lastEvent: "Package departed the regional sorting facility.",
5
+ nextStep: "The carrier will scan the package at the destination facility.",
6
+ },
7
+ ord_1002: {
8
+ status: "delayed",
9
+ lastEvent: "Weather interrupted the scheduled carrier route.",
10
+ nextStep: "The carrier will publish a revised route after conditions clear.",
11
+ },
12
+ };
13
+
14
+ export default function lookupOrder({ orderId }) {
15
+ const order = orders[orderId];
16
+ if (!order) {
17
+ return {
18
+ orderId,
19
+ status: "not_found",
20
+ lastEvent: "No order matched the supplied identifier.",
21
+ nextStep: "Confirm the order identifier with the customer.",
22
+ };
23
+ }
24
+ return { orderId, ...order };
25
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "lookup_order",
3
+ "description": "Look up the latest confirmed state of an order.",
4
+ "execution": "local",
5
+ "parameters": {
6
+ "type": "object",
7
+ "properties": {
8
+ "orderId": {
9
+ "type": "string",
10
+ "description": "The order identifier supplied by the customer."
11
+ }
12
+ },
13
+ "required": ["orderId"],
14
+ "additionalProperties": false
15
+ },
16
+ "outputSchema": {
17
+ "type": "object",
18
+ "properties": {
19
+ "orderId": { "type": "string" },
20
+ "status": { "type": "string" },
21
+ "lastEvent": { "type": "string" },
22
+ "nextStep": { "type": "string" }
23
+ },
24
+ "required": ["orderId", "status", "lastEvent", "nextStep"],
25
+ "additionalProperties": false
26
+ },
27
+ "timeoutMs": 5000,
28
+ "sideEffect": false
29
+ }
@@ -0,0 +1,5 @@
1
+ import { defineEvaluations } from "orchajs/evaluations";
2
+
3
+ export default defineEvaluations({
4
+ supportQuality: "./supportQuality",
5
+ });
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "support_quality",
3
+ "description": "Grounding and usefulness of order-support responses.",
4
+ "instructions": "Judge whether the order guidance is fully grounded in recorded lookup results and gives the customer a useful confirmed next step. Do not reward invented delivery estimates, unsupported shipment claims, or operational promises absent from the session.",
5
+ "enabled": true,
6
+ "provider": "openai",
7
+ "model": "gpt-5-mini",
8
+ "maxTokens": 4000,
9
+ "reasoningLevel": "minimal",
10
+ "metrics": [
11
+ {
12
+ "name": "groundedness",
13
+ "description": "Every shipment claim is supported by the recorded lookup result.",
14
+ "threshold": 0.85
15
+ },
16
+ {
17
+ "name": "next_step",
18
+ "description": "The response clearly communicates the confirmed operational next step without inventing an estimate.",
19
+ "threshold": 0.8
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "provider": "openai",
3
+ "model": "gpt-5-mini",
4
+ "region": "provider_managed",
5
+ "maxTokens": 4096,
6
+ "outputType": "text"
7
+ }
@@ -0,0 +1,5 @@
1
+ You are an order support specialist.
2
+
3
+ Always use lookup_order before making claims about an order. Explain the
4
+ confirmed status, latest event, and next step in plain language. Never invent
5
+ delivery dates or shipment events.
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "delayed_order_handling",
3
+ "description": "Handle confirmed carrier delays without inventing delivery estimates.",
4
+ "triggers": [
5
+ "An order lookup reports a delayed status.",
6
+ "The customer says an expected shipment has not arrived."
7
+ ]
8
+ }
@@ -0,0 +1,6 @@
1
+ State the confirmed delay reason and latest recorded event without implying a
2
+ new delivery date.
3
+
4
+ Explain the next operational step and who owns it. If the lookup does not
5
+ contain a revised estimate, explicitly say that no revised estimate is
6
+ confirmed yet.
@@ -0,0 +1,5 @@
1
+ import { defineSkills } from "orchajs/skills";
2
+
3
+ export default defineSkills({
4
+ delayedOrderHandling: "./delayedOrderHandling",
5
+ });
@@ -0,0 +1,37 @@
1
+ {
2
+ "description": "Looks up a delayed order and reports its confirmed next step.",
3
+ "input": {
4
+ "content": "Order ord_1002 has not arrived. What happened and what happens next?"
5
+ },
6
+ "actions": {
7
+ "lookup_order": {
8
+ "responses": [
9
+ {
10
+ "output": {
11
+ "orderId": "ord_1002",
12
+ "status": "delayed",
13
+ "lastEvent": "Weather interrupted the scheduled carrier route.",
14
+ "nextStep": "The carrier will publish a revised route after conditions clear."
15
+ }
16
+ }
17
+ ]
18
+ }
19
+ },
20
+ "expect": {
21
+ "status": "completed",
22
+ "text": {
23
+ "contains": ["weather", "carrier"],
24
+ "excludes": ["delivered"]
25
+ },
26
+ "actions": [
27
+ {
28
+ "name": "lookup_order",
29
+ "arguments": {
30
+ "equals": {
31
+ "orderId": "ord_1002"
32
+ }
33
+ }
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,5 @@
1
+ import { defineTests } from "orchajs/testing";
2
+
3
+ export default defineTests({
4
+ delayedOrder: "./delayedOrder",
5
+ });
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "__PROJECT_NAME__",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "node --env-file=.env --import tsx --watch src/server.ts",
8
+ "build": "node scripts/build.mjs",
9
+ "start": "node --env-file=.env dist/server.js",
10
+ "orcha:dev": "orcha dev",
11
+ "orcha:test": "orcha test"
12
+ },
13
+ "dependencies": {
14
+ "orchajs": "__ORCHA_VERSION__"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^24.3.1",
18
+ "esbuild": "^0.25.9",
19
+ "tsx": "^4.20.5",
20
+ "typescript": "^5.9.2"
21
+ },
22
+ "engines": {
23
+ "node": ">=20"
24
+ }
25
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "agents": {
3
+ "approvalAgent": {
4
+ "description": "Review purchase requests through an application-owned human approval step.",
5
+ "examples": [
6
+ {
7
+ "label": "Request purchase approval",
8
+ "content": "Request approval for a 1250 USD annual observability subscription needed by the platform team."
9
+ }
10
+ ]
11
+ },
12
+ "assistant": {
13
+ "description": "Answer general questions while keeping confirmed facts separate from assumptions.",
14
+ "examples": [
15
+ {
16
+ "label": "Explain a technical concept",
17
+ "content": "Explain idempotency in APIs with one practical example."
18
+ },
19
+ {
20
+ "label": "Multimodal content",
21
+ "content": [
22
+ {
23
+ "type": "text",
24
+ "text": "Describe the important information in this image."
25
+ },
26
+ {
27
+ "type": "image",
28
+ "mimeType": "image/png",
29
+ "fileUri": "https://raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png"
30
+ }
31
+ ]
32
+ }
33
+ ]
34
+ },
35
+ "orderSupport": {
36
+ "description": "Look up confirmed order data and explain its status and operational next step.",
37
+ "examples": [
38
+ {
39
+ "label": "Track an in-transit order",
40
+ "content": "Where is order ord_1001?"
41
+ },
42
+ {
43
+ "label": "Investigate a delayed order",
44
+ "content": "Order ord_1002 has not arrived. What happened and what happens next?"
45
+ }
46
+ ]
47
+ }
48
+ }
49
+ }