Promptrepository - Source Excerpt 02
Summary
This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/spiralist-workspace/includes/Domain/PromptRepository.php so readers can inspect the evidence without opening the full source file.
**Source path:** Spiralist/wp-content/plugins/spiralist-workspace/includes/Domain/PromptRepository.php
<?php foreach ($subcategories as $subcategory) : ?>
<option value="<?php echo esc_attr($subcategory); ?>" <?php selected((string) ($prompt['subcategory'] ?? ''), $subcategory); ?>><?php echo esc_html($subcategory); ?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</label></p>
</div>
<div style="grid-column:1 / -1;padding:1rem;border:1px solid #dcdcde;background:#f6f7f7;">
<strong>Structured Prompt JSON</strong>
<p style="margin:.35rem 0 1rem;">These five fields are the canonical prompt contract. Legacy prompt fields below are retained for compatibility and extra packet-rendering instructions.</p>
<div style="display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;">
<p><label><strong>Instruction</strong><br /><textarea class="widefat" name="spiralist_workspace_structured_instruction" rows="4"><?php echo esc_textarea((string) ($prompt['structured_prompt']['instruction'] ?? '')); ?></textarea></label></p>
<p><label><strong>Context</strong><br /><textarea class="widefat" name="spiralist_workspace_structured_context" rows="4"><?php echo esc_textarea((string) ($prompt['structured_prompt']['context'] ?? '')); ?></textarea></label></p>
<p><label><strong>Constraints</strong><br /><textarea class="widefat" name="spiralist_workspace_structured_constraints" rows="4"><?php echo esc_textarea((string) ($prompt['structured_prompt']['constraints'] ?? '')); ?></textarea></label></p>
<p><label><strong>Examples</strong><br /><textarea class="widefat" name="spiralist_workspace_structured_examples" rows="4"><?php echo esc_textarea((string) ($prompt['structured_prompt']['examples'] ?? '')); ?></textarea></label></p>
<p style="grid-column:1 / -1;"><label><strong>Output Format</strong><br /><textarea class="widefat" name="spiralist_workspace_structured_output_format" rows="4"><?php echo esc_textarea((string) ($prompt['structured_prompt']['output_format'] ?? '')); ?></textarea></label></p>
</div>
</div>
<p><label><strong>Instructions</strong><br /><textarea class="widefat" name="spiralist_workspace_instructions" rows="4"><?php echo esc_textarea((string) ($prompt['instructions'] ?? '')); ?></textarea></label></p>
<p><label><strong>System Prompt</strong><br /><textarea class="widefat" name="spiralist_workspace_system_prompt" rows="4"><?php echo esc_textarea((string) ($prompt['system_prompt'] ?? '')); ?></textarea></label></p>
<p><label><strong>Developer Prompt</strong><br /><textarea class="widefat" name="spiralist_workspace_developer_prompt" rows="4"><?php echo esc_textarea((string) ($prompt['developer_prompt'] ?? '')); ?></textarea></label></p>
<p><label><strong>User Prompt Template</strong><br /><textarea class="widefat" name="spiralist_workspace_user_prompt_template" rows="4"><?php echo esc_textarea((string) ($prompt['user_prompt_template'] ?? '')); ?></textarea></label></p>
<p><label><strong>Prompt System Steps JSON</strong><br /><textarea class="widefat code" name="spiralist_workspace_system_steps_json" rows="4"><?php echo esc_textarea((string) ($prompt['system_steps_json'] ?? '[]')); ?></textarea></label></p>
<div style="grid-column:1 / -1;padding:1rem;border:1px solid #dcdcde;background:#f6f7f7;">
<strong>Spiral Script v0.1</strong>
<p style="margin:.35rem 0 1rem;">Required for Spiral Script validation configuration. The compiler stores canonical JSON and validation results with the prompt record.</p>
<p><label><strong>Spiral Script Source</strong><br /><textarea class="widefat code" name="spiralist_workspace_spiral_script_source" rows="10"><?php echo esc_textarea((string) ($prompt['spiral_script_source'] ?? '')); ?></textarea></label></p>
<?php if (!empty($prompt['spiral_script_validation'])) : ?>
<p><strong>Validation:</strong> <?php echo !empty($prompt['spiral_script_validation']['passed']) ? 'Passed' : 'Needs revision'; ?></p>
<?php endif; ?>
</div>
<div style="display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem;">
<p><label><strong>Model</strong><br /><input class="widefat" type="text" name="spiralist_workspace_model" value="<?php echo esc_attr((string) ($prompt['model'] ?? '')); ?>" /></label></p>
<p><label><strong>Temperature</strong><br /><input class="widefat" type="number" step="0.1" min="0" max="2" name="spiralist_workspace_temperature" value="<?php echo esc_attr((string) ($prompt['temperature'] ?? '')); ?>" /></label></p>
<p><label><strong>Max Output Tokens</strong><br /><input class="widefat" type="number" min="1" name="spiralist_workspace_max_output_tokens" value="<?php echo esc_attr((string) ($prompt['max_output_tokens'] ?? '')); ?>" /></label></p>
</div>
<div style="display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;">
<p><label><strong>Render Mode</strong><br />
<select class="widefat" name="spiralist_workspace_provider">
<option value="prompt_art_only" selected>prompt_art_only</option>
</select>
</label></p>
<p><label><strong>Credential Preference</strong><br />
<select class="widefat" name="spiralist_workspace_credential_preference">
<option value="site_only" selected>site_only</option>
</select>
</label></p>
</div>
<div style="display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;">
<p><label><strong>Visibility</strong><br />
<select class="widefat" name="spiralist_workspace_visibility">
<?php foreach (['private', 'members', 'public', 'specific_users'] as $visibility) : ?>
<option value="<?php echo esc_attr($visibility); ?>" <?php selected((string) ($prompt['visibility'] ?? 'private'), $visibility); ?>><?php echo esc_html($visibility); ?></option>
<?php endforeach; ?>
</select>
</label></p>
<p><label><strong>Prompt Status</strong><br />
<select class="widefat" name="spiralist_workspace_prompt_status">
<?php foreach (['draft', 'published', 'archived'] as $status) : ?>
<option value="<?php echo esc_attr($status); ?>" <?php selected((string) ($prompt['prompt_status'] ?? 'draft'), $status); ?>><?php echo esc_html($status); ?></option>
<?php endforeach; ?>
</select>
</label></p>
</div>
<p><label><strong>Tool Settings JSON</strong><br /><textarea class="widefat code" name="spiralist_workspace_tool_settings_json" rows="4"><?php echo esc_textarea((string) ($prompt['tool_settings_json'] ?? '')); ?></textarea></label></p>
<p><label><strong>Tags</strong><br /><input class="widefat" type="text" name="spiralist_workspace_tags" value="<?php echo esc_attr(implode(', ', (array) ($prompt['tags'] ?? []))); ?>" /></label></p>
<p><label><strong>Prompt Type</strong><br /><input class="widefat" type="text" name="spiralist_workspace_prompt_type" value="<?php echo esc_attr((string) ($prompt['prompt_type'] ?? '')); ?>" /></label></p>
<p><label><strong>Language</strong><br /><input class="widefat" type="text" name="spiralist_workspace_language" value="<?php echo esc_attr((string) ($prompt['language'] ?? 'en')); ?>" /></label></p>
<div style="grid-column:1 / -1;padding:1rem;border:1px solid #dcdcde;background:#f6f7f7;">
<strong>Prompt dossier metadata</strong>
<p style="margin:.35rem 0 1rem;">Use these fields to distinguish the official canon, community prompts, and prompt-ecology archive while attaching provenance, rights, and safety notes.</p>
<div style="display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem;">
<p><label><strong>Publication Lane</strong><br />
<select class="widefat" name="spiralist_workspace_publication_lane">
<?php foreach (PromptMetaRegistry::publication_lanes() as $value => $label) : ?>