@morkaai/runtime 0.0.0-stage → 0.2.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.
Files changed (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -2
  3. package/bin/morka.cjs +57 -0
  4. package/dist/agent-actions/access.js +44 -0
  5. package/dist/agent-actions/manifest.js +52 -0
  6. package/dist/agent-actions/runner.js +69 -0
  7. package/dist/agents/account.js +42 -0
  8. package/dist/agents/acp-sandbox.js +118 -0
  9. package/dist/agents/activity.js +26 -0
  10. package/dist/agents/attachments.js +129 -0
  11. package/dist/agents/context.js +76 -0
  12. package/dist/agents/contracts.js +2 -0
  13. package/dist/agents/process.js +61 -0
  14. package/dist/agents/providers/acp.js +411 -0
  15. package/dist/agents/providers/claude.js +180 -0
  16. package/dist/agents/providers/codex.js +416 -0
  17. package/dist/agents/registry.js +76 -0
  18. package/dist/agents/sessions.js +331 -0
  19. package/dist/app-runtime/bridge.js +40 -0
  20. package/dist/app-runtime/starter/agents.json +1 -0
  21. package/dist/app-runtime/starter/index.html +11 -0
  22. package/dist/app-runtime/starter/main.js +0 -0
  23. package/dist/app-runtime/starter/package-lock.json +13 -0
  24. package/dist/app-runtime/starter/package.json +9 -0
  25. package/dist/app-runtime/starter/server.mjs +20 -0
  26. package/dist/app-runtime/starter/styles.css +0 -0
  27. package/dist/app-runtime/text-file.js +18 -0
  28. package/dist/branding/Morka.icns +0 -0
  29. package/dist/branding/README.md +24 -0
  30. package/dist/branding/generated-app-icon.png +0 -0
  31. package/dist/branding/morka-icon.png +0 -0
  32. package/dist/branding/morka-logo.png +0 -0
  33. package/dist/electron/main.js +802 -0
  34. package/dist/electron/preload.js +51 -0
  35. package/dist/instances/desktop.js +223 -0
  36. package/dist/instances/distribution.js +240 -0
  37. package/dist/instances/macos.js +62 -0
  38. package/dist/instances/repository.js +183 -0
  39. package/dist/instances/shadow-repository.js +95 -0
  40. package/dist/project/app-proxy.js +325 -0
  41. package/dist/project/bundle-toolchain.js +35 -0
  42. package/dist/project/drafts.js +27 -0
  43. package/dist/project/files.js +176 -0
  44. package/dist/project/live-preview.js +198 -0
  45. package/dist/project/managed-runtime.js +324 -0
  46. package/dist/project/node-lifecycle.js +45 -0
  47. package/dist/project/packages.js +302 -0
  48. package/dist/project/page-state.js +198 -0
  49. package/dist/project/project.js +112 -0
  50. package/dist/project/shadow-effects.js +156 -0
  51. package/dist/project/shadows.js +122 -0
  52. package/dist/project/toolchain.js +216 -0
  53. package/dist/renderer/activity.js +91 -0
  54. package/dist/renderer/app-setup.js +126 -0
  55. package/dist/renderer/chat-tools.css +83 -0
  56. package/dist/renderer/highlight.css +118 -0
  57. package/dist/renderer/icons/attach.png +0 -0
  58. package/dist/renderer/icons/brain-weight.png +0 -0
  59. package/dist/renderer/icons/brain.png +0 -0
  60. package/dist/renderer/icons/chat.png +0 -0
  61. package/dist/renderer/icons/chevron.png +0 -0
  62. package/dist/renderer/icons/clone.png +0 -0
  63. package/dist/renderer/icons/close.png +0 -0
  64. package/dist/renderer/icons/document.png +0 -0
  65. package/dist/renderer/icons/edit.png +0 -0
  66. package/dist/renderer/icons/folder.png +0 -0
  67. package/dist/renderer/icons/import.png +0 -0
  68. package/dist/renderer/icons/open-folder.png +0 -0
  69. package/dist/renderer/icons/play.png +0 -0
  70. package/dist/renderer/icons/plus.png +0 -0
  71. package/dist/renderer/icons/remove.png +0 -0
  72. package/dist/renderer/icons/search.png +0 -0
  73. package/dist/renderer/icons/send.png +0 -0
  74. package/dist/renderer/icons/shadow.png +0 -0
  75. package/dist/renderer/icons/stop.png +0 -0
  76. package/dist/renderer/icons/terminal.png +0 -0
  77. package/dist/renderer/index.html +130 -0
  78. package/dist/renderer/launcher/OFL.txt +93 -0
  79. package/dist/renderer/launcher/cell.js +322 -0
  80. package/dist/renderer/launcher/launcher.css +79 -0
  81. package/dist/renderer/launcher/lexend-caption-bold.ttf +0 -0
  82. package/dist/renderer/launcher.html +23 -0
  83. package/dist/renderer/licenses/dompurify.txt +202 -0
  84. package/dist/renderer/licenses/github-slugger.txt +5 -0
  85. package/dist/renderer/licenses/highlight.js.txt +29 -0
  86. package/dist/renderer/licenses/marked-footnote.txt +21 -0
  87. package/dist/renderer/licenses/marked-gfm-heading-id.txt +21 -0
  88. package/dist/renderer/licenses/marked.txt +44 -0
  89. package/dist/renderer/markdown.css +43 -0
  90. package/dist/renderer/markdown.js +74 -0
  91. package/dist/renderer/renderer.js +18902 -0
  92. package/dist/renderer/styles.css +351 -0
  93. package/dist/skills/morka-agent-action/SKILL.md +39 -0
  94. package/dist/skills/morka-app/SKILL.md +36 -0
  95. package/dist/skills/morka-shadow-authoring/SKILL.md +32 -0
  96. package/package.json +30 -4
@@ -0,0 +1,351 @@
1
+ :root {
2
+ font: 13px / 1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
3
+ color: #20232e;
4
+ background: #f2f3f7;
5
+ color-scheme: light;
6
+ --surface: #fff;
7
+ --line: #e1e3eb;
8
+ --muted: #61677a;
9
+ --accent: #5147c9;
10
+ --accent-soft: #eeecff;
11
+ --active: #08964d;
12
+ --motion-ease: cubic-bezier(.22, .75, .25, 1);
13
+ --chat-duration: 260ms;
14
+ --dialog-duration: 180ms;
15
+ }
16
+
17
+ * { box-sizing: border-box; }
18
+ body { margin: 0; height: 100dvh; display: grid; grid-template-rows: 54px minmax(0, 1fr); }
19
+ button, input, textarea, select { font: inherit; }
20
+ button { cursor: pointer; }
21
+ button:disabled { cursor: default; }
22
+ :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
23
+ [hidden] { display: none !important; }
24
+
25
+ .titlebar {
26
+ display: flex;
27
+ align-items: center;
28
+ gap: 16px;
29
+ padding-inline: 83px 14px;
30
+ -webkit-app-region: drag;
31
+ }
32
+ .wordmark { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 690; letter-spacing: -.025em; white-space: nowrap; }
33
+ .titlebar-actions, .toolbar { display: flex; align-items: center; }
34
+ .titlebar-actions { min-width: 0; gap: 10px; margin-inline-start: auto; }
35
+ .toolbar { flex: none; gap: 3px; padding: 3px; border: 1px solid #e3e4eb; border-radius: 10px; background: #ffffffd6; }
36
+ .icon-button, .agent-indicator {
37
+ display: inline-grid;
38
+ place-items: center;
39
+ flex: none;
40
+ inline-size: 30px;
41
+ block-size: 28px;
42
+ border: 0;
43
+ border-radius: 6px;
44
+ background: transparent;
45
+ color: #525970;
46
+ padding: 0;
47
+ }
48
+ .icon-button { -webkit-app-region: no-drag; }
49
+ .icon-button:disabled { color: #868b99; }
50
+ .icon-button:hover:enabled { background: #eff0f6; color: #222638; }
51
+ #chat-toggle[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
52
+ .agent-indicator { color: #686e81; }
53
+ .agent-indicator[data-active="true"] {
54
+ color: var(--active);
55
+ filter: drop-shadow(0 0 2px #08964db3);
56
+ animation: brain-pulse 2.6s ease-in-out infinite;
57
+ }
58
+ @keyframes brain-pulse {
59
+ 0%, 100% { opacity: .7; filter: drop-shadow(0 0 2px #08964db3); }
60
+ 50% { opacity: 1; filter: drop-shadow(0 0 3.5px #08964dcc); }
61
+ }
62
+ .icon {
63
+ inline-size: 21px;
64
+ block-size: 21px;
65
+ background: currentColor;
66
+ mask: var(--glyph) center / contain no-repeat;
67
+ pointer-events: none;
68
+ }
69
+ .icon-brain { --glyph: url("icons/brain.png"); }
70
+ .agent-indicator[data-active="true"] .icon-brain { --glyph: url("icons/brain-weight.png"); }
71
+ .icon-chat { --glyph: url("icons/chat.png"); }
72
+ .icon-clone { --glyph: url("icons/clone.png"); }
73
+ .icon-import { --glyph: url("icons/import.png"); }
74
+ .icon-shadow { --glyph: url("icons/shadow.png"); }
75
+ .icon-open-folder { --glyph: url("icons/open-folder.png"); }
76
+ .icon-remove { --glyph: url("icons/remove.png"); }
77
+ .icon-close { --glyph: url("icons/close.png"); inline-size: 17px; block-size: 17px; }
78
+ .icon-play { --glyph: url("icons/play.png"); }
79
+ .icon-stop { --glyph: url("icons/stop.png"); inline-size: 16px; block-size: 16px; }
80
+ .icon-send { --glyph: url("icons/send.png"); }
81
+ .icon-plus { --glyph: url("icons/plus.png"); inline-size: 19px; block-size: 19px; }
82
+ #runtime-status { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
83
+
84
+ .app-button {
85
+ -webkit-app-region: no-drag;
86
+ flex: none;
87
+ border: 1px solid var(--line);
88
+ border-radius: 8px;
89
+ padding: 6px 13px;
90
+ background: var(--surface);
91
+ color: #33384b;
92
+ font-weight: 650;
93
+ }
94
+ .app-button:hover:enabled { background: var(--accent-soft); }
95
+ .app-button.primary { border-color: var(--accent); background: var(--accent); color: white; }
96
+ .app-button.primary:hover:enabled { background: #4136b2; }
97
+ .app-button:disabled { opacity: .55; }
98
+ .welcome { align-self: center; width: min(340px, calc(100% - 56px)); margin-inline: auto; padding-bottom: 32px; }
99
+ .welcome h1 { margin: 0; font-size: 29px; font-weight: 690; letter-spacing: -.045em; }
100
+ .welcome p { margin: 9px 0 21px; color: var(--muted); font-size: 14px; }
101
+ .welcome-status { display: block; margin-top: 14px; color: var(--muted); }
102
+ .install-notice {
103
+ position: fixed;
104
+ inset: auto 24px 24px auto;
105
+ max-width: 290px;
106
+ padding: 9px 13px;
107
+ border: 1px solid var(--line);
108
+ border-radius: 8px;
109
+ background: var(--surface);
110
+ color: var(--muted);
111
+ box-shadow: 0 4px 18px #23214313;
112
+ }
113
+ .app-setup {
114
+ width: min(360px, calc(100% - 40px));
115
+ padding: 22px;
116
+ border: 1px solid var(--line);
117
+ border-radius: 14px;
118
+ color: inherit;
119
+ box-shadow: 0 16px 48px #23214328;
120
+ opacity: 0;
121
+ transform: translateY(8px) scale(.985);
122
+ transition: opacity var(--dialog-duration) var(--motion-ease),
123
+ transform var(--dialog-duration) var(--motion-ease),
124
+ display var(--dialog-duration) allow-discrete,
125
+ overlay var(--dialog-duration) allow-discrete;
126
+ }
127
+ .app-setup[open] { opacity: 1; transform: none; }
128
+ .app-setup:not([open]) { pointer-events: none; }
129
+ .app-setup::backdrop {
130
+ background-color: transparent;
131
+ transition: background-color var(--dialog-duration),
132
+ display var(--dialog-duration) allow-discrete,
133
+ overlay var(--dialog-duration) allow-discrete;
134
+ }
135
+ .app-setup[open]::backdrop { background-color: #20232e38; }
136
+ @starting-style {
137
+ .app-setup[open] { opacity: 0; transform: translateY(8px) scale(.985); }
138
+ .app-setup[open]::backdrop { background-color: transparent; }
139
+ }
140
+ .app-setup form { display: grid; gap: 9px; }
141
+ .app-setup h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.03em; }
142
+ .app-setup label { font-weight: 600; }
143
+ .app-setup input { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; }
144
+ .app-setup [role="status"] { color: var(--muted); overflow-wrap: anywhere; }
145
+ .setup-actions { display: flex; justify-content: end; gap: 8px; margin-top: 9px; }
146
+ .shadows-dialog { width: min(560px, calc(100% - 40px)); }
147
+ .shadows-heading, .shadows-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
148
+ .shadows-heading h2 { margin: 0; }
149
+ .shadows-list { list-style: none; padding: 0; margin: 14px 0; max-height: 45vh; overflow: auto; }
150
+ .shadows-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
151
+ .shadows-list small { display: block; margin-top: 3px; color: var(--muted); }
152
+ .shadows-actions { display: flex; flex-wrap: wrap; gap: 8px; }
153
+ .icon-button.shadow-action {
154
+ inline-size: 34px;
155
+ block-size: 34px;
156
+ border: 1px solid var(--line);
157
+ border-radius: 8px;
158
+ }
159
+ .shadow-action.primary { color: white; border-color: var(--accent); background: var(--accent); }
160
+ .shadow-action.primary:hover:enabled { color: white; background: #4136b2; }
161
+ .shadow-action:disabled { opacity: .55; }
162
+ .icon-button.shadow-remove:hover:enabled { color: #a72e45; background: #fff0f3; }
163
+ #shadow-create { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
164
+ .shadow-workspace .workspace[data-chat-open="true"] { grid-template-columns: minmax(0, 1fr); transition: none; }
165
+ .shadow-workspace .chat-panel { width: auto; border: 0; transition: none; }
166
+
167
+ .workspace {
168
+ --chat-width: clamp(342px, 38vw, 460px);
169
+ display: grid;
170
+ grid-template-columns: minmax(0, 1fr) 0px;
171
+ gap: 0;
172
+ min-height: 0;
173
+ margin: 0 10px 10px;
174
+ border: 1px solid var(--line);
175
+ border-radius: 12px;
176
+ overflow: hidden;
177
+ background: var(--surface);
178
+ transition: grid-template-columns var(--chat-duration) var(--motion-ease);
179
+ }
180
+ .workspace[data-chat-open="true"] { grid-template-columns: minmax(0, 1fr) var(--chat-width); }
181
+ .preview-panel { min-width: 0; min-height: 0; }
182
+ .preview-panel iframe { display: block; width: 100%; height: 100%; border: 0; background: white; }
183
+ .chat-panel {
184
+ width: var(--chat-width);
185
+ min-height: 0;
186
+ display: flex;
187
+ flex-direction: column;
188
+ border-inline-start: 1px solid var(--line);
189
+ background: #fcfcfe;
190
+ visibility: hidden;
191
+ opacity: 0;
192
+ transform: translateX(18px);
193
+ transition: opacity var(--chat-duration) var(--motion-ease),
194
+ transform var(--chat-duration) var(--motion-ease),
195
+ visibility 0s linear var(--chat-duration);
196
+ }
197
+ .workspace[data-chat-open="true"] .chat-panel { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
198
+ .chat-heading { display: flex; align-items: center; justify-content: space-between; padding: 14px 17px 7px 19px; }
199
+ .chat-heading h1 { margin: 0; font-size: 15px; font-weight: 680; letter-spacing: -.025em; }
200
+ .chat-heading .icon-button { border: 1px solid var(--line); background: var(--surface); }
201
+ .chat-navigation { padding: 0 17px 12px 19px; border-bottom: 1px solid #edeef4; }
202
+ .chat-select {
203
+ min-width: 0;
204
+ width: 100%;
205
+ appearance: none;
206
+ min-height: 30px;
207
+ border: 0;
208
+ border-radius: 8px;
209
+ background: transparent url("icons/chevron.png") right 5px center / 12px no-repeat;
210
+ color: #41434b;
211
+ padding: 6px 19px 6px 7px;
212
+ text-overflow: ellipsis;
213
+ white-space: nowrap;
214
+ cursor: pointer;
215
+ transition: background-color 120ms ease;
216
+ }
217
+ .chat-select:hover:enabled { background-color: #f0f1f3; color: #202127; }
218
+ .chat-select:disabled { color: #92949d; cursor: default; }
219
+ .chat-select:focus-visible { outline: 2px solid #9da0ab; outline-offset: 1px; }
220
+ #chat-picker { min-height: 34px; background-color: #f4f5f7; padding-inline-start: 10px; }
221
+
222
+ .feed { min-height: 0; flex: 1; overflow-y: auto; padding: 20px 19px; overscroll-behavior: contain; }
223
+ .intro { max-width: 320px; margin: clamp(26px, 12vh, 105px) auto 0; }
224
+ .intro h2 { margin: 0 0 16px; font-size: 22px; font-weight: 650; letter-spacing: -.035em; }
225
+ position: relative;
226
+ min-height: 39px;
227
+ border: 1px solid var(--line);
228
+ border-radius: 8px;
229
+ color: #454b62;
230
+ background: var(--surface);
231
+ padding: 7px 30px 7px 11px;
232
+ text-align: start;
233
+ }
234
+ .transcript { display: grid; gap: 15px; }
235
+ .message { min-width: 0; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
236
+ .message-content { min-width: 0; text-align: start; }
237
+ .message.user {
238
+ justify-self: end;
239
+ max-width: 92%;
240
+ padding: 8px 11px;
241
+ border-radius: 12px 12px 4px 12px;
242
+ background: var(--accent-soft);
243
+ color: #2b2954;
244
+ }
245
+ .message.assistant { padding: 2px 1px; }
246
+ .message.error { padding: 8px 11px; border: 1px solid #f1d2d5; border-radius: 8px; background: #fff3f4; color: #8c2634; }
247
+ .message.activity { padding-inline-start: 8px; border-inline-start: 2px solid #d8dbea; color: var(--muted); font-size: 12px; }
248
+ .message-provider { display: block; margin-block-end: 3px; color: #5c6277; font-size: 11px; font-weight: 650; }
249
+
250
+ .composer {
251
+ margin: 0 13px 13px;
252
+ padding: 10px 10px 8px;
253
+ border: 1px solid #dedfe3;
254
+ border-radius: 17px;
255
+ background: var(--surface);
256
+ box-shadow: 0 2px 8px #20232e06;
257
+ }
258
+ .composer:focus-within { border-color: #b6b8c0; }
259
+ .composer textarea {
260
+ display: block;
261
+ width: 100%;
262
+ min-height: 55px;
263
+ max-height: 140px;
264
+ border: 0;
265
+ outline: 0;
266
+ padding: 2px 3px 6px;
267
+ resize: none;
268
+ field-sizing: content;
269
+ color: inherit;
270
+ }
271
+ .composer textarea:placeholder-shown { direction: ltr; }
272
+ .composer textarea::placeholder { color: #6e7386; }
273
+ .composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
274
+ .composer-options {
275
+ display: flex;
276
+ align-items: center;
277
+ flex: 1;
278
+ min-width: 0;
279
+ gap: 2px;
280
+ }
281
+ .composer-options select {
282
+ width: auto;
283
+ max-width: 100%;
284
+ field-sizing: content;
285
+ flex: 0 1 auto;
286
+ font-size: 11px;
287
+ font-weight: 500;
288
+ }
289
+ @supports (appearance: base-select) {
290
+ .chat-select,
291
+ .chat-select::picker(select) { appearance: base-select; }
292
+ .chat-select { display: inline-flex; align-items: center; background-image: none; padding-inline-end: 7px; gap: 5px; }
293
+ .chat-select::picker-icon {
294
+ content: "";
295
+ flex: none;
296
+ align-self: center;
297
+ width: 12px;
298
+ height: 12px;
299
+ background: url("icons/chevron.png") center / contain no-repeat;
300
+ opacity: .65;
301
+ transition: transform var(--dialog-duration) var(--motion-ease);
302
+ }
303
+ .chat-select:open::picker-icon { transform: rotate(180deg); }
304
+ .composer-options select::picker-icon { margin-inline-start: 0; }
305
+ .chat-select::picker(select) {
306
+ min-width: 170px;
307
+ max-width: min(360px, calc(100vw - 24px));
308
+ max-height: min(360px, 55vh);
309
+ margin-block: 6px;
310
+ padding: 5px;
311
+ border: 1px solid #e4e5e9;
312
+ border-radius: 12px;
313
+ background: #fff;
314
+ box-shadow: 0 6px 24px #20232e1f, 0 1px 4px #20232e0a;
315
+ color: #30323a;
316
+ opacity: 0;
317
+ transform: translateY(4px) scale(.98);
318
+ transition: opacity var(--dialog-duration) var(--motion-ease),
319
+ transform var(--dialog-duration) var(--motion-ease),
320
+ display var(--dialog-duration) allow-discrete,
321
+ overlay var(--dialog-duration) allow-discrete;
322
+ }
323
+ .chat-select::picker(select):popover-open { opacity: 1; transform: none; }
324
+ @starting-style {
325
+ .chat-select::picker(select):popover-open { opacity: 0; transform: translateY(4px) scale(.98); }
326
+ }
327
+ #chat-picker::picker(select) { width: anchor-size(width); max-width: min(460px, calc(100vw - 24px)); }
328
+ .chat-select option { padding: 7px 9px; border-radius: 7px; font-size: 12px; white-space: normal; }
329
+ .composer-options option[value=""]::after { content: "Default"; margin-inline-start: auto; color: #848791; font-size: 10px; }
330
+ .chat-select option:checked { background: #f2f3f5; }
331
+ .chat-select option:hover,
332
+ .chat-select option:focus { background: #eceef1; }
333
+ }
334
+ #status { display: block; margin: 3px 3px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
335
+ #status:empty { display: none; }
336
+ .composer .send, .composer .stop { color: white; background: #242529; inline-size: 30px; block-size: 30px; border-radius: 50%; }
337
+ .composer .send:hover:enabled, .composer .stop:hover:enabled { color: white; background: #42444a; }
338
+ .composer .send:disabled { background: #edeef1; color: #999ca6; }
339
+ .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
340
+
341
+ @media (prefers-reduced-motion: reduce) {
342
+ :root { --chat-duration: 0s; --dialog-duration: 0s; }
343
+ .agent-indicator[data-active="true"] { animation: none; }
344
+ }
345
+ #agent-setup { width: min(450px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
346
+ #agent-setup-accounts { list-style: none; margin: 12px 0; padding: 0; }
347
+ #agent-setup-accounts li { border-block-end: 1px solid #e4e2eb; padding: 10px 0; }
348
+ #agent-setup-accounts p { margin: 4px 0; }
349
+ #agent-setup-accounts code { display: block; overflow-wrap: anywhere; user-select: all; }
350
+ #agent-setup-accounts small { display: block; margin-top: 5px; }
351
+ #agent-setup .setup-actions { flex-wrap: wrap; }
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: morka-agent-action
3
+ description: Connect a Morka app control to an AI action with validated JSON input and output.
4
+ ---
5
+
6
+ # Add an agent action to Morka
7
+
8
+ For a managed Node app, register `agentActions: {"definitions":"agents.json","skills":"skills"}` in morka.project.json and include `<script src="/__morka/bridge.js"></script>` in the served HTML before app code uses window.morka. This same-origin bridge works with the host agent connection without exposing host IPC or credentials to the Node server. Add the action to the registered JSON file and write its execution skill under `<skills-directory>/<skill-name>/SKILL.md`. The execution skill needs `name` (matching its directory) and `description` in YAML frontmatter. Describe how the action should process the provided data in that skill.
9
+
10
+ `agents.json` is an array. Each entry has `id`, `skill`, `session` set to `"ephemeral"`, short `instructions`, and `inputSchema` and `outputSchema` as JSON Schema objects. Use unique lowercase hyphenated IDs, object schemas with explicit required fields, and `additionalProperties: false`. Call `await window.morka.runAgentAction(id, input)` from browser `main.js`. The Promise resolves to the validated output or rejects with an error. Bind it to the requested control, keep the existing add-on UI, and show loading, errors and results. Render external titles as text using DOM APIs.
11
+
12
+ Entries may set `provider` to `codex` or `claude`. When omitted, the user can choose a provider in the AI access prompt.
13
+
14
+ This action summarizes supplied text. The execution skill adds task-specific guidance. Include `session` and `instructions` in the JSON entry as shown.
15
+
16
+ ```json
17
+ [
18
+ {
19
+ "id": "summarize-text",
20
+ "skill": "summarize-text",
21
+ "session": "ephemeral",
22
+ "instructions": "Summarize the supplied text in one sentence.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": { "text": { "type": "string" } },
26
+ "required": ["text"],
27
+ "additionalProperties": false
28
+ },
29
+ "outputSchema": {
30
+ "type": "object",
31
+ "properties": { "summary": { "type": "string" } },
32
+ "required": ["summary"],
33
+ "additionalProperties": false
34
+ }
35
+ }
36
+ ]
37
+ ```
38
+
39
+ When the app needs external data, implement the integration in the app's Node backend and expose the needed data through a same-origin endpoint. Keep API credentials server-side. For features that need AI, pass the relevant response data as input to the action and describe how to interpret it in the execution skill. For features that only display fetched data, render the response directly.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: morka-app
3
+ description: Create or edit the Morka project's interface, runtime, services, and project instructions.
4
+ ---
5
+
6
+ # Edit a Morka project
7
+
8
+ Start with the project manifest used by the current draft. Apps use `morka.project.json`. Read `project_files` for editable file contents, `project_paths` for the file inventory, and `project_instructions` for the project's active rules and skills, including imported Shadows. Follow the existing layout. Use native `apply_patch` in the project draft. Morka validates the draft, then publishes its changes. If paths move, update their references in the manifest.
9
+
10
+ For a standard Morka Git repository, the draft root corresponds to `app/`. Edit paths relative to the draft root. The outer repository owns `README.md`, `AGENTS.md`, `package.json`, `package-lock.json`, Git metadata, and `.morka/`. Keep those outer files intact. The app has its own editable package.json and package-lock.json inside this draft (app/ in the repository); declare arbitrary app dependencies there. Keep assets and services inside the draft.
11
+
12
+ Use the app's Shadows panel to install or remove a Shadow. Direct package authoring to New Shadow or Open Shadow so it uses the independent package repository.
13
+
14
+ ## Startup layout
15
+
16
+ Morka apps run as independent managed Node services. Keep their `package.json`, `package-lock.json`, source and assets inside this draft. Set `runtime` to `{"type":"node","script":"start"}` in the version 1 manifest. The default readiness endpoint is `/health`. Define `scripts.start` as a foreground production server, for example `node server.mjs`, and bind to `Number(process.env.PORT)` and `process.env.HOST` (loopback). Never hardcode the managed internal port. `process.env.MORKA_APP_ORIGIN` is the stable browser origin; use it for absolute redirects and trust proxy headers only from the loopback proxy. Frontend code calls its backend over same-origin HTTP. Retain the starter script /__morka/bridge.js in HTML when using window.morka host agent actions; register actions with the top-level agentActions definitions/skills paths. Do not expose agent definitions, private configuration or data directories through static file serving.
17
+
18
+ Declare packages in this app's package.json, including build tools in devDependencies. Add `scripts.build` when a bundler/transpiler is needed (Vite, React, TypeScript, etc.). `scripts.start` and its server dependencies must work after devDependencies are pruned. Keep the existing lockfile so npm can update it in place. After draft edits, Morka resolves the lockfile, runs `npm ci` with dev dependencies in an isolated staging directory, executes build and optional `scripts["morka:check"]`, prunes dev dependencies, and seals an immutable release. For a request to install a package or run the app build, use this host workflow. In your reply, describe the edits and say that Morka will report npm and build results in the turn activity. Only report a verification result when you have real command output. The packaged app contains the matching standalone Node/npm pair, headers, production node_modules and build output. npm modules and native addons use this bundled Node ABI, never Electron's ABI. Do not rely on node_modules installed in the chat draft; it is never published. Local `file:` dependencies must be vendored under this draft, never point outside app/. Public registries, private registries and Git dependencies are supported through npm; registry credentials belong in the app's private runtime profile (`runtime/<app-id>/npm/npmrc`), not source. Private `npm.env` and `build.env` in that profile supply explicitly configured variables for installation and build/check scripts respectively; host API keys and the host npm configuration are not inherited.
19
+
20
+ Keep production servers healthy without writes or jobs during warmup. Morka starts a candidate while the current release still serves requests, then drains writes and switches the stable proxy only after health succeeds. The server's `globalThis.morkaRuntime.isActive()` indicates whether it owns the active release. Start background work on `process.on("morka:activate", ...)`, stop it on `process.on("morka:retire", ...)`, and check `isActive()` before committing scheduled work; use persistent idempotency/fencing for jobs. Do not run destructive schema migrations or send external messages during startup/health checks. Explicit live schema migrations use `runtime.migration: {"id":"add-field-v1","script":"migrate","compatibility":"backward-compatible"}`. Migration scripts must be transactional/idempotent, and compatible with both old and new code. Each migration ID runs once for the app. Code rollback never restores an old copy of user data. Breaking schema changes require a separate data migration design, not an ordinary visual edit.
21
+
22
+ Pure linked CSS edits without a build step are overlaid at the stable proxy without restarting the server or recreating the page. Other edits produce a new release and preserve the UI through the lifecycle hooks below. Install/build failures keep the published source and running app intact and are returned for one automatic repair attempt; unresolved drafts are preserved. Runtime health failures keep the previous running release active. Morka owns dependency installation and activation; never ask the user to run npm, press Run or reopen the app after an app edit.
23
+
24
+ ## Preserve user state during live edits
25
+
26
+ Morka replaces linked CSS without recreating the page. For code or markup updates it preserves the current route, history state, form values, focus, selections and scrolling. Keep element IDs, input names and state keys stable across edits. Do not reset user data, navigation or existing state to show a visual change.
27
+
28
+ Every app with in-memory UI state (filters, selected tabs/items, open panels, wizard steps, editor drafts) must expose `window.morkaLifecycle = { ready, beforeUpdate, capture, restore }`. `ready` is the promise for initial data loading; optional `beforeUpdate()` flushes pending work. `capture()` returns JSON-serializable UI state and `restore(state)` restores it after `ready`, tolerating missing fields from older versions. Merge new fields into existing hooks. Persist business data independently; never use this transient UI snapshot as the database. Do not include passwords, tokens or database contents in custom snapshots. Morka waits for tracked requests before restarting a service and defers an update if a selected file or unfinished operation cannot safely survive it.
29
+
30
+ For example, retain a task filter with `capture: () => ({ filter })` and `restore: state => setFilter(state?.filter ?? "all")`, with `ready: loadTasks()` so restoration happens after the initial render. Form values are restored by Morka; retain additional application state explicitly.
31
+
32
+ Store app databases and user files under `process.env.MORKA_DATA_DIR`, which Morka keeps outside source drafts. Existing user data paths must remain usable or be migrated without overwriting data. `.morka-data/`, SQLite/database files and their journal/WAL sidecars are excluded from source snapshots and cannot be published by source edits. Keep explicit user-requested data migrations separate from presentation edits.
33
+
34
+ ## Agent actions
35
+
36
+ Use `morka-agent-action` to add a control that sends data to an agent. Put app-specific integrations in the app backend.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: morka-shadow-authoring
3
+ description: Create, update, or validate a portable Morka Plugin Shadow package containing a persistent project rule, an adaptation skill, and optional examples or assets.
4
+ ---
5
+
6
+ # Author a Plugin Shadow
7
+
8
+ Treat the requested behavior as the package's rule for projects that import it, including phrases such as “from now on.” The draft root is this independent repository's `shadow/` directory. Write package files relative to that root with `apply_patch`. Use the app's Shadows panel to install the package when it is ready.
9
+
10
+ ## Package contract
11
+
12
+ Put `manifest.json` at the package root. Use JSON with the field names below. Include `assets` and `examples` only when the package includes them.
13
+
14
+ ```json
15
+ {
16
+ "id": "ui-conventions",
17
+ "version": "1.0.0",
18
+ "description": "Apply shared interface conventions.",
19
+ "skills": "skills/ui-conventions/SKILL.md",
20
+ "rules": "rules/ui.md",
21
+ "assets": ["media/palette.svg"],
22
+ "examples": ["examples/component.css"]
23
+ }
24
+ ```
25
+
26
+ - Use an ID of 1–63 lowercase ASCII letters, digits, or hyphens, starting with a letter or digit. Keep the ID when revising an existing package and choose a new version for the revision, such as `1.1.0`. Use a nonempty description of at most 1,000 characters.
27
+ - Resolve every listed path relative to the package root. Use separate files for `skills` and `rules`. Every listed path must point to an existing, nonempty regular file inside the package. Keep the manifest and each text entry at or below 32 KiB and the total referenced package size at or below 32 MiB.
28
+ - Put the lasting convention in the rule. State its intended scope and what it requires in future edits, including when its target is absent at import and added later.
29
+ - Give `SKILL.md` YAML frontmatter with `name` and `description`. Use the skill body to explain how the importing agent should identify the target in the actual project, adapt to its layout and conventions, and verify the result. Ask a focused question when multiple plausible targets would lead to different changes.
30
+ - Use `examples` for optional text snippets the agent can adapt and `assets` for files the package supplies. List only files owned by the package. Prefer a self-contained rule and skill with any essential details in their own files.
31
+
32
+ Before delivering, check the manifest against the files you created and confirm that the rule and skill describe the same behavior. Summarize what the Shadow will do when installed.
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "@morkaai/runtime",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.1",
4
+ "author": {
5
+ "name": "Mehrdad Farrokhmanesh",
6
+ "url": "https://github.com/mithrisys"
7
+ },
8
+ "license": "MIT",
9
+ "homepage": "https://github.com/mithrisys/morka#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/mithrisys/morka.git",
13
+ "directory": "packages/runtime"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/mithrisys/morka/issues"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "registry": "https://registry.npmjs.org/"
21
+ },
22
+ "description": "Electron desktop runtime and CLI for launching and installing Morka apps.",
23
+ "productName": "Morka",
24
+ "main": "dist/electron/main.js",
25
+ "bin": { "morka": "bin/morka.cjs" },
26
+ "files": ["bin", "dist"],
27
+ "engines": { "node": ">=24" },
28
+ "dependencies": {
29
+ "ajv": "8.17.1",
30
+ "electron": "43.4.0"
31
+ }
32
+ }